The following example shows how to tweak configuration options for the server via :
Configuring HTTP server settings
Property | Type | Description |
---|---|---|
| java.util.Map | Sets the Netty child worker options. |
| java.util.Map | Sets the channel options. |
| int | Sets the maximum initial line length for the HTTP request. Default value (4096). |
| int | Sets the maximum size of any one header. Default value (8192). |
int | Sets the maximum size of any single request chunk. Default value (8192). | |
boolean | Sets whether chunked transfer encoding is supported. Default value (true). | |
| boolean | Sets whether to validate incoming headers. Default value (true). |
| int | Sets the initial buffer size. Default value (128). |
| io.netty.handler.logging.LogLevel | Sets the Netty log level. |
| Sets the minimum size of a request body must be in order to be compressed. Default value (1024). | |
| int | Sets the compression level (0-9). Default value (6). |
| boolean | Sets whether to use netty’s native transport (epoll or kqueue) if available . Default value (false). |
java.lang.String | Sets the fallback protocol to use when negotiating via ALPN. |
The native Netty transports add features specific to a particular platform, generate less garbage, and generally improve performance when compared to the NIO based transport.
To enable native transports first add a necessarily dependency:
For macOS:
runtime("io.netty:netty-transport-native-kqueue:osx-x86_64")
For Linux:
Then configure the default event loop group to prefer native transports:
micronaut:
netty:
default: