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

This article explains how to replace the default Tomcat container in Spring Boot with Undertow, provides step‑by‑step configuration instructions, and presents benchmark results that show Undertow's superior throughput and lower memory usage under high‑concurrency workloads.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Replacing Tomcat with Undertow in Spring Boot: Configuration Guide and Performance Comparison

Introduction

In Spring Boot the default embedded container is Tomcat, but Undertow can be used as a replacement offering better performance and lower memory usage. This article explains how to switch to Undertow and compares the two containers.

Tomcat Container in Spring Boot

Spring Boot is a popular Java web framework that eliminates heavy XML configuration and allows developers to create a complete web service within minutes. Tomcat is the default embedded servlet container used by Spring Boot.

Configuring Undertow in Spring Boot

To replace Tomcat with Undertow, simply add the Undertow starter dependency to the project. After the dependency is added and the application is started, the embedded container switches to Undertow.

Comparison of Tomcat and Undertow

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

QPS Test Results

Undertow

Memory usage comparison

Tomcat

Undertow

Benchmark results show that Undertow outperforms Tomcat in both throughput and memory consumption under high‑concurrency conditions, making it the preferred choice for high‑traffic systems.

Conclusion

Both Tomcat and Undertow can serve as the HTTP engine in Spring Boot, but Undertow delivers superior performance and lower memory usage in high‑concurrency scenarios, so it is recommended 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.

JavaperformanceSpringBootWeb server
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.