Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Why Switch to Undertow? Boost SpringBoot Performance Over Tomcat

This article explains how to replace SpringBoot's default embedded Tomcat with Undertow, details the configuration steps, compares their performance and memory usage through benchmark results, and argues that Undertow offers superior throughput for high‑concurrency Java web applications.

Introduction

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

Tomcat Container in SpringBoot

SpringBoot is a popular Java web framework that eliminates heavy XML configuration, allowing developers to create a complete web service within minutes. The web container is essential; Tomcat is the default embedded container.

Configuring Undertow in SpringBoot

Besides Tomcat, SpringBoot can use Undertow by adding its dependency. After configuration, the application starts with Undertow as the container.

After configuration, launching the application shows that the container has been replaced by Undertow.

Why replace Tomcat with Undertow?

Comparison of Tomcat and Undertow

Tomcat is an Apache lightweight servlet container supporting Servlet and JSP, includes an HTTP server, and is free, making it popular among developers. Undertow, from Red Hat, is a flexible high‑performance web server written in Java, supporting both blocking and non‑blocking I/O, fully compatible with Servlet and WebSocket, and excels under high concurrency.

Benchmark Results

We performed load tests on the same machine. The QPS and memory usage comparisons are shown below.

Tomcat

Undertow

Tomcat Memory

Undertow Memory

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

Conclusion

SpringBoot can use either Tomcat or Undertow for HTTP services. For high‑concurrency business systems, Undertow provides better performance, so consider switching to achieve significant improvements.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

JavaSpringBootTomcatUndertowWebServerHighConcurrency

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion