Replacing Tomcat with Undertow in Spring Boot: Configuration and Performance Comparison

This article explains how to replace Spring Boot's default embedded Tomcat with the high‑performance Undertow server, details the necessary Maven dependencies and configuration steps, and presents benchmark results showing Undertow's superior throughput and lower memory usage under high‑concurrency workloads.

Java Captain
Java Captain
Java Captain
Replacing Tomcat with Undertow in Spring Boot: Configuration and Performance Comparison

Introduction

Spring Boot uses Tomcat as its default embedded servlet container, but it also supports Undertow, which offers better performance and lower memory consumption. This article explains how to switch from Tomcat to Undertow.

Tomcat in Spring Boot

Spring Boot is a popular Java web framework that simplifies creating web services. Tomcat is the default embedded container, providing servlet and JSP support.

Configuring Undertow in Spring Boot

To replace Tomcat with Undertow, simply add the Undertow starter dependency to the project (e.g., in Maven or Gradle). After adding the dependency and rebuilding, the application starts with Undertow as the embedded server.

Tomcat vs. Undertow Comparison

Tomcat is a lightweight servlet container that includes an HTTP server, while Undertow is a Red Hat open‑source, Java‑based, high‑performance web server supporting both blocking and non‑blocking I/O, servlet, and WebSocket.

Benchmark Results

Performance tests on identical hardware show that Undertow achieves higher QPS and uses less memory than Tomcat under the same request load.

QPS Comparison

Images illustrate that Undertow processes more requests per second than Tomcat.

Memory Usage Comparison

Images demonstrate that Undertow consumes less memory than Tomcat.

Conclusion

For high‑concurrency business systems, Undertow outperforms Tomcat in both throughput and memory efficiency, making it the preferred choice when replacing Tomcat in Spring Boot applications.

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.

JavaperformanceSpring BootWeb serverTomcatundertow
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java 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.