How does Spring Boot replace the default tomcat server?

HBLOG
4 min readAug 12, 2024

1. Why replace the default tomcat?

Tomcat is a lightweight servlet container under the Apache Foundation that supports both servlets and JSPs. Tomcat has features unique to web servers, including the Tomcat Management and Control Platform, the Security Bureau Administration, and the Tomcat Valve. Tomcat itself contains an HTTP server, so it can also be thought of as a separate web server. In the SpringBoot framework, we use Tomcat the most, which is SpringBoot’s default container technology, and it is embedded Tomcat.

Comparison of Tomcat vs Undertow

Undertow is an open source product of Red Hat, developed entirely in Java, and is a flexible, high-performance web server that supports both blocking and non-blocking IOs. Since Undertow is developed in Java, it can be embedded directly into Java projects. At the same time, Undertow fully supports servlets and Web sockets, which is very good in high-concurrency situations.

We stress tested Tomcat and Undertow under the same machine configuration, and the test results are as follows:

Comparison of QPS test results:

Tomcat

Undertow

--

--