Performance Tuning

In this guide you fill find basic advice for performance tuning of your Helidon application. Most of them target Netty tuning, as Helidon is based on it. You should also consider configuring/tuning Java heap size as per any Java application.

Configure Netty worker thread pool size

The Netty worker thread-pool is what handles your incoming requests. It defaults to 2*NCPU. To set it to something else you can set worker-count in resources/application.yaml:

server:
  port: 8080
  host: 0.0.0.0
  worker-count: 2
Copied

Configure Netty’s maxOrder (Helidon 2.4.1 or earlier)

In some situations Netty can aggressively allocate memory per request. This has been addressed in recent versions of Helidon and Netty, but if you are running an earlier version set this system property when you start your Helidon application:

-Dio.netty.allocator.maxOrder=6
Copied

You can try smaller numbers.

Bound entity materialization

Ordinary WebServer request and WebClient response conversions to byte arrays, strings, forms, JSON, and application-defined materializing readers have a decoded-input budget of 1 MiB (1,048,576 bytes). The budget applies after content filters and decoding, and applies independently to each materialized multipart part. It bounds input bytes rather than the resulting object graph or total JVM heap usage.

Configure max-buffered-entity-size in bytes on the server socket or client component node. The programmatic equivalents are WebServer.Builder.maxBufferedEntitySize(long), SocketConfiguration.Builder.maxBufferedEntitySize(long), and WebClient.Builder.maxBufferedEntitySize(long). Standalone media contexts support MediaContext.Builder.maxBufferedEntitySize(long) and the same configuration key. Zero permits only empty input; negative values are rejected when configuring the component.

server:
  max-buffered-entity-size: 16777216
client:
  max-buffered-entity-size: 16777216
Copied

Applications that previously materialized larger entities must explicitly increase this setting. A server conversion that exceeds its budget fails with HTTP 413; a client conversion fails with IllegalStateException. Custom MessageBodyReader implementations are materializing by default. A reader that processes input incrementally without accumulating it in memory can override streaming() to return true.

Direct InputStream access, direct DataChunk subscriptions, asStream conversions, and readers declaring streaming() are excluded from this budget. Lazy streaming entities retain ownership of their subscriptions until consumption finishes or is cancelled. The separate server max-payload-size limit continues to apply to streaming and materializing requests.