Backend Development 5 min read

Performance Tuning Guide for Undertow Web Server

This guide explains how to boost Undertow’s performance—outpacing Tomcat—by tuning I/O and worker thread counts, buffer sizes, timeouts, disabling unused features, using programmatic customizers, and enabling HTTP/2, with example application.yml settings for optimal speed and memory usage.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
Performance Tuning Guide for Undertow Web Server

Undertow is an open‑source high‑performance Java web server from Red Hat, offering both BIO and NIO mechanisms.

Why not tune Tomcat? While Tomcat can be tuned, Undertow generally outperforms it in speed and memory, making a direct switch preferable.

How to optimize Undertow

Thread pool configuration

Adjust the I/O and worker thread counts in application.yml :

server.undertow.io-threads=8
server.undertow.worker-threads=128

Buffer and memory settings

Typical values:

server.undertow.buffer-size=1024
server.undertow.direct-buffers=true
server.undertow.buffers-per-region=...

Connection and request timeouts

server.undertow.max-http-post-size=0
server.undertow.no-request-timeout=1800s

Disable unnecessary features

server.undertow.session-cookie-config=none
server.undertow.accesslog.enabled=false

Programmatic configuration can be done by implementing WebServerFactoryCustomizer<UndertowServletWebServerFactory> .

Enable HTTP/2 via server.undertow.enabled-http2=true .

Example application.yml snippet:

# IO threads
server.undertow.io-threads=16
# Worker threads
server.undertow.worker-threads=128
# Buffer size
server.undertow.buffer-size=512
# Direct buffers
server.undertow.direct-buffers=true
# HTTP/2
server.undertow.enabled-http2=true
JavaconfigurationPerformance Tuningweb serverUndertow
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.