The following example shows how to tweak configuration options for the server via :

    Configuring HTTP server settings

    Table 1. Configuration Properties for NettyHttpServerConfiguration
    PropertyTypeDescription

    micronaut.server.netty.child-options

    java.util.Map

    Sets the Netty child worker options.

    micronaut.server.netty.options

    java.util.Map

    Sets the channel options.

    micronaut.server.netty.max-initial-line-length

    int

    Sets the maximum initial line length for the HTTP request. Default value (4096).

    micronaut.server.netty.max-header-size

    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).

    micronaut.server.netty.validate-headers

    boolean

    Sets whether to validate incoming headers. Default value (true).

    micronaut.server.netty.initial-buffer-size

    int

    Sets the initial buffer size. Default value (128).

    micronaut.server.netty.log-level

    io.netty.handler.logging.LogLevel

    Sets the Netty log level.

    micronaut.server.netty.compression-threshold

    Sets the minimum size of a request body must be in order to be compressed. Default value (1024).

    micronaut.server.netty.compression-level

    int

    Sets the compression level (0-9). Default value (6).

    micronaut.server.netty.use-native-transport

    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:

    1. runtime("io.netty:netty-transport-native-kqueue:osx-x86_64")

    For Linux:

      Then configure the default event loop group to prefer native transports:

      1. micronaut:
      2. netty:
      3. default: