Backend Development 5 min read

Comparing Tomcat and Undertow in Spring Boot: Performance and Memory Usage

This article explains how Spring Boot uses Tomcat by default, shows how to replace it with Undertow, and presents benchmark results that demonstrate Undertow's superior throughput and lower memory consumption for high‑concurrency Java web applications.

Top Architect
Top Architect
Top Architect
Comparing Tomcat and Undertow in Spring Boot: Performance and Memory Usage

In the Spring Boot framework, Tomcat is the default embedded servlet container, but developers can replace it with Undertow, which offers better performance and lower memory usage.

Spring Boot is a popular Java web framework that simplifies project setup and embeds Tomcat as its standard container, providing essential web server capabilities for any web application.

To use Undertow, you only need to add the Undertow dependency to your project; the article includes images illustrating the required configuration steps.

Replacing Tomcat with Undertow can improve performance, especially under high‑concurrency workloads.

Tomcat, an Apache‑licensed lightweight servlet container, supports Servlet, JSP, and includes an HTTP server, while Undertow, a Red Hat open‑source project written in Java, offers both blocking and non‑blocking I/O, full Servlet and WebSocket support, and excels in high‑concurrency scenarios.

The article presents benchmark results comparing Tomcat and Undertow on the same hardware, showing QPS and memory usage charts:

The tests show that Undertow outperforms Tomcat in both throughput and memory consumption, especially for high‑concurrency business systems, making it the preferred choice for such scenarios.

In conclusion, Spring Boot allows the use of either Tomcat or Undertow as the HTTP server, and for high‑traffic applications, Undertow provides better performance and resource efficiency.

JavaperformanceSpring BootTomcatUndertowweb container
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

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.