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.
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
