Comparing Tomcat and Undertow in SpringBoot: Performance and Memory Usage

This article explains how SpringBoot uses Tomcat by default, demonstrates how to replace it with the high‑performance Undertow container, compares their features, and presents benchmark results showing Undertow’s superior throughput and lower memory consumption for high‑concurrency Java web applications.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Comparing Tomcat and Undertow in SpringBoot: Performance and Memory Usage

Introduction

In SpringBoot the default embedded servlet container is Tomcat, which is widely used for Java web applications.

SpringBoot also supports the Undertow container, which offers better performance and lower memory usage; this article shows how to switch to Undertow.

SpringBoot’s Tomcat Container

SpringBoot is a popular Java web framework that simplifies development by eliminating XML configuration and providing an embedded Tomcat server to run web services.

Configuring Undertow in SpringBoot

To replace Tomcat with Undertow, add the Undertow starter dependency to the project. After rebuilding, the application starts with Undertow as the embedded server.

Comparison of Tomcat and Undertow

Tomcat is an Apache‑licensed lightweight servlet container that also includes an HTTP server; it is free and widely adopted.

Undertow, developed by Red Hat, is a fully Java‑based, flexible, high‑performance web server supporting both blocking and non‑blocking I/O, servlet, and WebSocket.

Benchmark Results

Performance tests on identical hardware measured QPS and memory usage. The Tomcat results are shown in the first chart, Undertow results in the second.

Undertow QPS chart:

Memory usage comparison:

The tests indicate that Undertow delivers higher throughput and uses less memory than Tomcat under high concurrency.

Conclusion

Both Tomcat and Undertow can serve HTTP in SpringBoot, but Undertow outperforms Tomcat in high‑concurrency scenarios, making it the preferred choice for performance‑critical services.

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.

SpringBootTomcatundertow
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

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.