Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

This article explains how to replace SpringBoot's default embedded Tomcat with Undertow, compares their performance and memory usage through benchmark tests, and shows why Undertow is a superior choice for high‑concurrency Java web applications.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

Introduction

SpringBoot uses Tomcat as its default embedded container, but Undertow offers better performance and lower memory usage. This article explains how to replace Tomcat with Undertow in a SpringBoot project.

Tomcat Container in SpringBoot

SpringBoot is a popular Java web framework that simplifies creating web services. The embedded Tomcat container is the most commonly used servlet container in SpringBoot applications.

Configuring Undertow in SpringBoot

To use Undertow, add the Undertow starter dependency to the project (as shown in the image). After rebuilding, the application runs with Undertow instead of Tomcat.

Tomcat vs. Undertow Comparison

Tomcat is a lightweight servlet container from the Apache foundation, supporting Servlet and JSP, and includes an HTTP server. Undertow, developed by Red Hat, is a high‑performance, flexible Java‑based web server that supports blocking and non‑blocking I/O, servlet, and WebSocket.

Benchmark tests on identical hardware show that Undertow achieves higher QPS and lower memory consumption than Tomcat.

1. QPS Test Results

Tomcat

Undertow

2. Memory Usage Comparison

Tomcat

Undertow

The tests indicate that in high‑concurrency scenarios Undertow outperforms Tomcat in both throughput and memory efficiency, and its default use of persistent connections further improves performance.

Conclusion

Both Tomcat and Undertow can serve HTTP in SpringBoot, but Undertow delivers superior performance for high‑traffic systems, making it a recommended choice for such workloads.

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.

JavaSpringBootWeb serverTomcatundertow
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

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.