Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

This article explains how to replace SpringBoot's default embedded Tomcat with the high‑performance Undertow container, compares their architectures, presents benchmark results on QPS and memory usage, and shows why Undertow is the better 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

Introduction

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

Tomcat in SpringBoot

SpringBoot is currently the most popular Java web framework. It lets developers create a complete web service within minutes, freeing them from heavy XML configuration. The most commonly used container in SpringBoot is the embedded Tomcat server.

Configuring Undertow in SpringBoot

Tomcat is familiar to most Java developers, but SpringBoot can also run on Undertow. By adding the Undertow starter dependency, the embedded container is replaced.

After adding the dependency and restarting the application, the container switches to Undertow.

Why replace Tomcat with Undertow?

Undertow, an open‑source product from Red Hat, is a flexible high‑performance web server written in Java. It supports both blocking and non‑blocking I/O, full servlet and WebSocket support, and shows excellent behavior under high concurrency.

Tomcat vs Undertow: Pros and Cons

Tomcat, an Apache‑licensed lightweight servlet container, also includes an HTTP server. It is free and widely loved, but its performance under high load is weaker than Undertow.

Undertow is a Java‑based high‑performance server that can be embedded directly into Java projects. It supports both blocking and non‑blocking I/O, servlet, and WebSocket, and performs very well under high concurrency.

Benchmark Results

QPS comparison

Tomcat

Undertow

Memory usage comparison

Tomcat

Undertow

Tests show that under the same hardware, Undertow delivers higher throughput and lower memory consumption than Tomcat, especially for high‑concurrency systems. Therefore, Undertow is the preferred choice for such workloads.

Conclusion

SpringBoot can run on either Tomcat or Undertow. For high‑concurrency scenarios, Undertow outperforms Tomcat, so switching can significantly improve system performance.

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.