|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +read_time: true |
| 4 | +show_date: true |
| 5 | +title: Power up! Optimize IIIF user experience |
| 6 | +description: Configuration settings for a well performant IIIF user experience with Omeka S |
| 7 | +date: 2024-08-15 |
| 8 | +img: posts/power-up-web.jpg |
| 9 | +tags: [ omeka s, iiif ] |
| 10 | +author: Maarten Coonen |
| 11 | +--- |
| 12 | + |
| 13 | +Running Omeka S with the IIIF modules configured on a machine with average hardware leads to a workable situation in most cases. |
| 14 | +However, there are some things you need to know in order to make your user's experience much better. |
| 15 | + |
| 16 | + |
| 17 | +## Boost image processing performance with vips |
| 18 | +Image files are being preprocessed (resized and tiled) by Omeka S at time of upload so that the IIIF ImageServer can |
| 19 | +optimally serve the tiles whenever an image is requested over HTTP. Omeka S has support for multiple image processing |
| 20 | +libraries that are available as PHP extensions. In most cases, GD or ImageMagick are being used, as these are preinstalled by |
| 21 | +most Linux distributions. The [ImageServer module](https://omeka.org/s/modules/ImageServer/) recommends to use the |
| 22 | +[**vips** image processor](https://www.libvips.org/), as this one is much faster. |
| 23 | + |
| 24 | +Our benchmarks confirm that vips is blazingly fast. Processing a 127 MB TIF file during upload on our test Omeka S system |
| 25 | +took 15 minutes with Imagemagick and only 1 second with vips! With the JPEG 2000 format the difference is even more extreme: |
| 26 | +44 minutes with Imagemagick vs. 1 second with vips. |
| 27 | +As one can imagine, these reductions in processing time greatly enhance the productivity of collection managers working |
| 28 | +with the system. |
| 29 | + |
| 30 | +vips is easy to install. Just use the command below to install it from your distro's package manager if you have |
| 31 | +Debian 12 (or higher) or Ubuntu 24.04 (or higher). People running Ubuntu 20.04 can follow the installation instructions |
| 32 | +from our [previous blog](./installing-iiif-with-omekas.html). |
| 33 | +```bash |
| 34 | +# Debian 12 & Ubuntu 24.04 |
| 35 | +apt-get install libvips-tools |
| 36 | +``` |
| 37 | + |
| 38 | +## Choose "Tiled tiff" as tiling method |
| 39 | +The image preprocessing (resizing and tiling) jobs in Omeka S ensure that (high-resolution) image files are converted |
| 40 | +to a format that can be optimally served over the internet, while still preserving all details and zoomability. One way |
| 41 | +to do this is by using a pyramidal image format like [pyramidal TIFF](https://training.iiif.io/iiif-online-workshop/day-two/fileformats.html). |
| 42 | + |
| 43 | + |
| 44 | +A pyramidal image consists of multiple layers, each representing the image in different resolution. At initial load, |
| 45 | +the layer with the lowest resolution (and smallest size) is served to the image viewer. When a user zooms in, a deeper layer |
| 46 | +with higher resolution is used to serve only the tiles that are in the viewpane. The rest of the image is not loaded, which |
| 47 | +saves network bandwidth and results in a faster loading time. |
| 48 | + |
| 49 | +Source image files that are being uploaded to Omeka S are stored in the `original/` sub folders. The tiled copies are |
| 50 | +stored in the `tile/` sub folders. |
| 51 | +```bash |
| 52 | +./files/original/<itemID>/<filename>.jpg ------| |
| 53 | + | |
| 54 | +./files/original/<itemID>/<filename>.jp2 ------|---- Pyramidal TIFF ----> ./files/tile/<itemID>/<filename>.tif |
| 55 | + | |
| 56 | +./files/original/<itemID>/<filename>.tif ------| |
| 57 | +``` |
| 58 | + |
| 59 | +The Omeka S module [ImageServer](https://omeka.org/s/modules/ImageServer/) provides multiple tiling methods: |
| 60 | +- Deep Zoom Image |
| 61 | +- Zoomify |
| 62 | +- Jpeg 2000 |
| 63 | +- Tiled tiff |
| 64 | + |
| 65 | +Based on our tests, the **Tiled tiff** method works best, as it saves disk storage capacity, has the fastest upload experience |
| 66 | +and has a reasonable page loading time. |
| 67 | + |
| 68 | +Note: although the "Deep Zoom Image" and "Zoomify" options serve images the fastest, they are still not our preferred format |
| 69 | +as they cause HTTP-404 errors for tiles that cannot be loaded. |
| 70 | + |
| 71 | + |
| 72 | +## Increase page load performance with parallel processing |
| 73 | +The time of single core processors has passed a long time ago. Nowadays, all CPUs have 2 or more cores that can do work |
| 74 | +simultaneously. Apache, PHP-FPM and Omeka S are able to work multi-threaded, thereby putting multiple cores to work in |
| 75 | +serving the image tiles to the user requesting it. This greatly enhances performance. |
| 76 | + |
| 77 | +Modern data centers run virtualized servers and allow you to increase the amount of CPU cores with the click of a |
| 78 | +button, as long as you continue to pay your bills. Virtualized cores cost money as well! |
| 79 | + |
| 80 | +We've conducted a series of tests with various source file types (JP2000, TIFF, JPG compression quality 80 (JPGq80) and |
| 81 | +JPG compression quality 40 (JPGq40)) to determine the optimal amount of CPU cores. Our base line tests were run on 4 CPU |
| 82 | +cores. Subsequently, we've repeated the same tests with 8 and 16 cores. |
| 83 | + |
| 84 | +The results are shown in the figure below. On average, 8 CPU cores load a page 31.3% (8 cores) and 36.5% faster |
| 85 | +(16 cores) compared to 4 cores when tested with these file types. We expect that adding more cores will increase performance |
| 86 | +even further, although the gain per added core will be less. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +## TODO: Save disk space and increase page load performance by using JPG compressed source images |
| 91 | +tiled tiff from jp2 processed again by vips at page load. WE don't see this with other formats. This is why jp2 performs least. |
| 92 | +TIFF format loads fastest, but takes a lot of disk space. |
| 93 | +JPGq80 is the best compromise |
| 94 | + |
| 95 | + |
| 96 | +## Conclusion |
| 97 | +Our preferred setup consists of a machine with the characteristics below. |
| 98 | + |
| 99 | +- CPU: 16 cores or more |
| 100 | +- Memory: 16 GB or more |
| 101 | +- Disk: 250 GB or more |
| 102 | +- Operating System: Ubuntu 20.04 or higher |
| 103 | +- Web server: Apache 2.4 or higher with HTTP/2 and PHP-FPM modules and CORS headers enabled (see details in [previous blog](./installing-iiif-with-omekas.html)) |
| 104 | +- PHP: version 8.2 or higher |
| 105 | +- Image processing: vips 8.14.1 or higher & Imagemagick 6.9.11 (with jp2 extension enabled) or higher |
| 106 | +- Omeka S module Image server - Image processor: Automatic (Vips when possible, ... (etc.)) |
| 107 | +- Omeka S module Image server - tiling type: Tiled tiff |
0 commit comments