Back to Playframework

Configuring Netty Server Backend

documentation/manual/working/commonGuide/configuration/SettingsNetty.md

3.1.0-M92.8 KB
Original Source
<!--- Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> -->

Configuring Netty Server Backend

The Netty server backend is built on top of Netty.

Note: The Netty server backend is not the default in 2.6.x, and so must be specifically enabled. See more information in [[Netty Server|NettyServer]] documentation.

Default configuration

Play uses the following default configuration:

@

The configurations above are specific to Netty server backend, but other more generic configurations are also available:

@

Configuring transport socket

Native socket transport has higher performance and produces less garbage and is available on Linux, macOS, FreeBSD and OpenBSD. You can configure the transport socket type in application.conf:

properties
play.server {
  netty {
    transport = "native"
  }
}

In addition to native, you can set transport to io_uring to make use of Netty's io_uring native transport. Be aware io_uring is available on Linux only.

When set to native or io_uring, Play will automatically detect the operating system it is running on and load the appropriate native transport library.

Note: On Windows, if the transport configuration is set to native or io_uring, Play will ignore it and automatically fall back to Java NIO transport - just like when using the default jdk config. A similiar fallback mechanism kicks in on macOS: If transport is set to io_uring, Play will fall back to native instead, because the io_uring native transport is not available on macOS - but on Linux only (using Kernel 5.14 or newer compiled with CONFIG_IO_URING=y - which is the default anyway).

Configuring channel options

The available options are defined in the Netty channel option documentation.

If you are using the native socket transport, you can set the following additional options: