Chapter 9. Undertow Subsystem Tuning

The non-blocking I/O undertow subsystem introduced in JBoss EAP 7 has greatly improved performance compared to the previous web subsystem in JBoss EAP 6. Opportunities for tuning the undertow subsystem for your environment include configuring buffer caches, JSP settings, and listeners.

9.1. Buffer Caches

A buffer cache is used to cache static files handled by the undertow subsystem. This includes images, static HTML, CSS, and JavaScript files. You can specify a default buffer cache for each Undertow servlet container. Having an optimized buffer cache for your servlet container can improve Undertow performance for serving static files.

Buffers in a buffer cache are allocated in regions, and are of a fixed size. There are three configurable attributes for each buffer cache:

The size of an individual buffer, in bytes. The default is 1024 bytes. Red Hat recommends that you set the buffer size to entirely store your largest static file.
The number of buffers per region. The default is 1024.
The maximum number of regions, which sets a maximum amount of memory allocated to the buffer cache. The default is 10 regions.

You can calculate the maximum amount memory used by a buffer cache by multiplying the buffer size, the number of buffers per region, and the maximum number of regions. For example, the default buffer cache is 1024 bytes * 1024 buffers per region * 10 regions = 10MB.

Configure your buffer caches based on the size of your static files, and the results from testing expected loads in a development environment. When determining the effect on performance, consider the balance of the buffer cache performance benefit versus the memory used.

For instructions on using the management CLI to configure buffer caches, see Configuring Buffer Caches in the JBoss EAP Configuration Guide.

9.2. Configuring Byte Buffer Pools

Undertow byte buffer pools are used to allocate pooled NIO ByteBuffer instances. All listeners have a byte buffer pool and you can use different buffer pools and workers for each listener. Byte buffer pools can be shared between different server instances.

For a full list of the attributes available for configuring byte buffer pools, see Byte Buffer Pool Attributes in the JBoss EAP Configuration Guide.

The main byte buffer pool attribute that significantly affects performance is buffer-size. The default is calculated based on the RAM resources of your system, and is sufficient in most cases. If you are configuring this attribute manually, an ideal size for most servers is 16KB.

See the JBoss EAP Configuration Guide for instructions on how to create and configure byte buffer pools.

9.3. JSP Configuration

There are JSP configuration options for Undertow servlet containers that provide optimizations for how JSP pages are compiled into Java bytecode.

If your JSPs contain a lot of String constants, enabling this option optimizes scriplets by converting the String constants to char arrays.
If your JSPs contain many String concatenations, enabling this option optimizes scriplets by removing String concatenation for every JSP request.
If your JSPs contain a lot of white space, enabling this option trims the white space from HTTP requests and reduces HTTP request payload.

Configuring JSP Options

You can enable these Undertow JSP configuration options using the management console or management CLI.

  • To enable them using the management console:

    1. Navigate to ConfigurationSubsystemsWeb (Undertow)Servlet Container.
    2. Select the servlet container you want to configure and click View.
    3. Select JSP and click Edit.
    4. For each option you want to enable, set the field to ON and then click Save.
  • To enable them using the management CLI, use the following command:


    For example, to enable generate-strings-as-char-arrays for the default servlet container, use the following command:


9.4. Listeners

Depending on your applications and environment, you can configure multiple listeners specific to certain types of traffic, for example, traffic on specific ports, and then configure options for each listener.

The following are selected performance-related options that can be configured on HTTP, HTTPS, and AJP listeners.


The maximum number of concurrent connections that the listener can handle. By default this attribute is undefined, which results in unlimited connections.

You can use this option to set a ceiling on the number of connections a listener can handle, which might be useful to cap resource usage. In configuring this value you should consider your workload and traffic type. Also see no-request-timeout below.


The length of time in milliseconds that a connection is idle before it is closed. The default value is 60000 milliseconds (1 minute).

Tuning this option in your environment for optimal connection efficiency can help improve network performance. If idle connections are prematurely closed, there are overheads in re-establishing connections. If idle connections are open for too long, they unnecessarily use resources.


The maximum size of a HTTP request header, in bytes. The default is 1048576 (1024KB).

Limiting the header size can be useful to prevent certain types of denial of service attacks.


Specifies the buffer pool in the io subsystem to use for the listener. By default, all listeners use the default buffer pool.

You can use this option to configure each listener to use a unique buffer pool, or have multiple listeners use the same buffer pool.


The undertow subsystem relies on the io subsystem to provide XNIO workers. This option specifies the XNIO worker that the listener uses. By default, a listener uses the default worker in the io subsystem.

It might be useful to configure each listener to use a specific worker so you can assign different worker resources to certain types of network traffic.

Configuring Listener Options

You can configure listener options using the management console or management CLI.

  • To configure them using the management console:

    1. Navigate to ConfigurationSubsystemsWeb (Undertow)Server.
    2. Select the server you want to configure and click View.
    3. In the left menu, select Listener then select the type of listener to configure, for example HTTP Listener, and select the listener in the table.
    4. CLick Edit, modify the options you want to configure, and click Save.
  • To configure them using the management CLI, use the following command:


    For example, to set max-connections to 100000 for the default HTTP listener in the default-server Undertow server, use the following command: