Replacing Tomcat with Undertow in SpringBoot: Configuration, Features, and Performance Comparison

This article explains how SpringBoot's default Tomcat container can be swapped for the high‑performance Undertow server, details Undertow's characteristics, provides Maven configuration steps with code snippets, and presents benchmark results showing superior throughput and lower memory usage for high‑concurrency applications.

Top Architect
Top Architect
Top Architect
Replacing Tomcat with Undertow in SpringBoot: Configuration, Features, and Performance Comparison

In SpringBoot, Tomcat is the default embedded servlet container, but Undertow offers higher performance and lower memory consumption, making it a compelling alternative for high‑concurrency services.

Undertow is a flexible, high‑performance Java web server supporting both blocking and non‑blocking I/O, fully compatible with Java EE Servlet 3.1, and serves as the default server for Red Hat's WildFly.

To replace Tomcat with Undertow, remove the Tomcat starter from the SpringBoot dependencies and add the Undertow starter. The required Maven snippets are:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

After updating the dependencies and restarting the application, the embedded server switches to Undertow. Benchmark tests on identical hardware show that Undertow achieves higher QPS and consumes less memory than Tomcat, especially under heavy load, and it enables persistent connections by default.

Therefore, for applications with high request volumes, adopting Undertow in SpringBoot can significantly improve performance and resource 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.

javaTomcatundertowwebserver
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn 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.