Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

This article explains how to replace SpringBoot's default embedded Tomcat with Undertow, shows configuration steps, compares their performance and memory usage through benchmarks, and concludes that Undertow is the superior choice for high‑concurrency Java web applications.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

Preface

In the SpringBoot framework the most commonly used container is Tomcat, which is the default embedded server. SpringBoot also supports the Undertow container, which offers better performance and lower memory consumption. This article explains how to switch to Undertow.

Tomcat Container in SpringBoot

SpringBoot is currently the most popular Java web framework. It frees developers from heavy XML configuration, allowing a complete web service to be created within minutes, greatly improving development efficiency. A web container is essential for any web project, and Tomcat is the default embedded container in SpringBoot.

Configuring Undertow in SpringBoot

Tomcat is familiar to Java developers as the most common servlet container. To replace it, simply add the Undertow dependency to the project. After adding the dependency (see the images below) and rebuilding, the application starts with Undertow as the embedded server.

Why Replace Tomcat with Undertow?

Undertow, an open‑source product from Red Hat, is written entirely in Java. It is a flexible, high‑performance web server that supports both blocking and non‑blocking I/O, can be embedded directly into Java projects, and fully supports Servlet and WebSocket, performing exceptionally well under high concurrency.

Tomcat vs. Undertow: Performance Comparison

Benchmark tests on identical hardware show the following results:

QPS Test Results

Tomcat

Undertow

Memory Usage Comparison

Tomcat

Undertow

The tests reveal that under high‑concurrency scenarios Tomcat performs weaker, while Undertow delivers higher throughput and lower memory consumption. Additionally, the latest Undertow version uses persistent connections by default, further improving concurrency handling.

Conclusion

In SpringBoot you can use either Tomcat or Undertow as the HTTP server. For high‑concurrency business systems, Undertow outperforms Tomcat in both performance and memory usage. Switching to Undertow can significantly boost your system's efficiency.

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.

JavaperformanceSpringBootWeb serverTomcatundertow
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

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.