Replacing Tomcat with Undertow in Spring Boot: Performance and Memory Comparison

This article explains how to replace the default embedded Tomcat container in Spring Boot with Undertow, outlines the necessary dependency configuration, compares their performance and memory usage through benchmark results, and recommends Undertow for high‑concurrency Java web applications.

Architecture Digest
Architecture Digest
Architecture Digest
Replacing Tomcat with Undertow in Spring Boot: Performance and Memory Comparison

Spring Boot uses Tomcat as its default embedded servlet container, but it also supports the Undertow container, which offers better performance and lower memory consumption. This guide shows how to switch from Tomcat to Undertow by adding the appropriate Undertow dependency to a Spring Boot project.

To enable Undertow, include the Undertow starter dependency (for example,

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-undertow</artifactId></dependency>

) in your build configuration. After rebuilding and starting the application, the embedded server will be Undertow instead of Tomcat.

The article compares the two containers: Tomcat is a lightweight Java servlet container with built‑in HTTP server capabilities, while Undertow, developed by Red Hat, is a flexible high‑performance web server supporting both blocking and non‑blocking I/O, servlet, and WebSocket.

Benchmark tests on the same hardware show that Undertow achieves higher QPS and uses less memory than Tomcat. The results are illustrated with screenshots of the QPS and memory usage charts for both servers.

In conclusion, for high‑concurrency business systems, Undertow outperforms Tomcat in both throughput and memory efficiency, making it the preferred choice when performance is critical.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendJavaSpringBootTomcatundertow
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

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.