This manual refers to a future version of the software that is still in development. It may be incomplete or inaccurate and the software may change before a final release.

Deployment & Tuning

This page gathers some miscellaneous notes on production deployment and performance tuning.

Temporary Directory

By default, when running in standalone mode, the embedded Jetty server caches class files in the system temp directory, which most operating systems will periodically clean out. If this happens while the application is running, it can cause NoClassDefFoundErrors that can only be remedied by restarting the application. Consider either reconfiguring your OS's temp-cleaning strategy to work only at boot or shutdown, or setting the temp_pathname configuration key to use a different location for temporary data.


Some image formats are inherently more efficient to process than others. If you have control over your source image formats, see the Images section for recommendations.

Health Checks

While the root path can be used for basic health checks, a dedicated health check endpoint that exercises more of the application is available.



Cantaloupe allocates one thread per request, and maintains a thread pool to carry out certain tasks asynchronously and spread work across processors. Response times will benefit from multiple fast cores.

Some source formats are more processor-intensive than others. JPEG2000 via OpenJpegProcessor, for example, will work the CPU much harder than uncompressed TIFF via Java2dProcessor.


Memory requirements will vary greatly depending on processors used, source format, source image size, request image size, and request frequency. Image formats that don't support tiling or that can't be selectively decoded will require more memory to process (see Images). The application will log an ERROR-level message if it runs out of memory.

Heap Memory

As a Java application, the application runs "sandboxed" inside a Java Virtual Machine (JVM), and can only use the memory the JVM makes available to it. The main area of memory of concern inside the JVM is called the heap, and its size characteristics must be configured at startup using arguments to the java command. The two most important are:

Initial heap size. The heap may grow beyond this up to the maximum size, with perhaps a performance penalty during "growth spurts."
Maximum heap size.
These arguments aren't necessary in Docker when using JRE 8u191 or later, as that version introduced support for auto-detecting container CPU and memory settings.

The commands in the Getting Started section specify a relatively small maximum heap size, and a production server may need larger.

Operating system utilities like top, Task Manager, Activity Monitor, etc. can show you what a process looks like as the OS sees it, but they can't show what's happening inside a process. A tool like JConsole, included in the Java Development Kit (JDK), can visualize memory usage inside a running JVM.

JConsole screenshot
Screenshot of JConsole

Garbage Collection

Heap memory is freed automatically by a garbage collector (GC) that runs in the JVM. One of the problems with Java garbage collection in general is that it can cause periodic freezes of all applications running in the VM. Ideally the freezes are too short to notice, but sometimes that isn't the case.

Over the years, the JVM's default GC implementation has changed as new GCs have been developed that try to improve efficiency and reduce freezes. Java 7 and 8 use the Parallel GC. The G1 GC became the default in Java 9. Java 11 introduced ZGC as an experimental new GC, and Java 12 introduced Shenandoah as another experimental GC. All of these GCs can be experimented with by passing command-line arguments to the java invocation.


Most source formats benefit from fast read performance—in terms of both latency and throughput—in the underlying storage system. Throughput is more important for less efficient source formats—like JPEG, PNG, and mono-resolution TIFF—especially as source image size increases. Local filesystem storage usually performs best.

As derivative images tend to be small, storage performance is less important for derivative caches.


See the Caching section for information about the built-in caching options, which can dramatically improve performance. When using automatic maintenance in a cluster, consider enabling it on only one node.


  • The max_scale configuration option can be used to disallow requests for large scales that could overwhelm the server.
  • A max_pixels configuration option is available to limit the maximum returned size of processed images. This is a "safety net" to prevent excessively expensive requests. It does not affect requests for full-sized unmodified images, which do not significantly load the server.
    • Note that the authorize() delegate method can play the same role as max_pixels, with more granular control.
  • In standalone mode, http.min_threads, http.max_threads, and http.accept_queue_limit can be used to adjust the characteristics of the built-in web server's request thread pool and queue. When any of the values are exceeded, the application will refuse to fulfill requests by returning HTTP 503 Service Unavailable.


Cantaloupe can run behind a reverse-proxy web server like Apache or nginx. The proxy should be set up to pass-through encoded URI characters without decoding them. It should also be configured to send the following headers:

Header Description Required?
X-Forwarded-Proto Protocol of the client request; either HTTP or HTTPS. If missing, HTTP is assumed. No
X-Forwarded-Host FQDN of the client-facing reverse proxy. Yes
X-Forwarded-Port TCP port of the client-facing reverse proxy. If missing, the following are consulted in priority order:
  1. The port in the X-Forwarded-Host header;
  2. The default port of the protocol in the X-Forwarded-Proto header;
  3. The request port.
X-Forwarded-Path Path to use as a base path. No
X-Forwarded-For Client IP address. If missing, any features that require a client IP address will either not work (such as IP-based authorization), or be incorrect (such as access logs). No
X-Forwarded-ID Originally-requested image identifier. Should be set only when the proxy server will change the value of the identifier in the forwarded request; i.e. when the client is asking for a different identifier than the image server ends up seeing. No

If the proxy cannot be configured to send the X-Forwarded headers, the base_uri configuration option can be used instead; set it to the URI of the client-facing reverse proxy including any base path.

In a reverse-proxying scenario, consider disabling the access log, if it would be redundant.


The following example will make an instance running at http://image-server:8182/ available at http://apache-server/.

<VirtualHost *:80>
  # X-Forwarded-Host will be set automatically by the web server.
  RequestHeader set X-Forwarded-Proto HTTP
  RequestHeader set X-Forwarded-Port 80
  RequestHeader set X-Forwarded-Path /

  ServerName apache-server
  AllowEncodedSlashes NoDecode
  ProxyPassReverseCookiePath / /
  ErrorLog logs/image-error.log
  CustomLog logs/image-access.log combined

  ProxyPass / http://image-server:8182/ nocanon
  ProxyPassReverse / http://image-server:8182/
  ProxyPassReverseCookieDomain image-server:8182 apache-server
  ProxyPreserveHost on


The following example will make an instance running at http://image-server:8182/ available at http://nginx-server/.

location / {
    if ($request_uri ~* "/(.*)") {
        proxy_pass http://image-server:8182/$1;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-Path /;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect http://image-server:8182/ /;


Cantaloupe supports TLS connections over HTTPS, configurable via the https.* keys in the configuration file. The general process for getting this working is to add a signed X.509 certificate to either a Java KeyStore (JKS) or PKCS#12 key store, and then refer to the key store file with the https.key_store_path configuration option.