Why do so many SpringBoot developers abandoned the Tomcat, select the Undertow?

Foreword

In SpringBoot framework, we use the most is Tomcat, which is SpringBoot default container technology, but is embedded in Tomcat.

At the same time, SpringBoot also supports Undertow container, we can easily replace Tomcat with Undertow, and Undertow performance and memory usage are better than Tomcat, then how do we use technology Undertow? In this paper we will carefully explain.

The Tomcat container SpringBoot

SpringBoot can be said is the hottest of the Java Web framework. It developers from heavy xml rescued, so that the developer can create a complete Web services in minutes, greatly improving the efficiency of developers. Web container Web technology is an integral part of the project, because any Web project should be up and running by means of container technology.

In SpringBoot framework, we use the most is Tomcat, which is SpringBoot default container technology, but is embedded in Tomcat.

SpringBoot set Undertow

For technical Tomcat, Java programmers should be very familiar, it is the most commonly used Web container technology. Our earliest development projects are basically deployed to run under Tomcat, in addition to that Tomcat container, SpringBoot what we also can use container technology it?

Yes, that is the title of Undertow container technology. SrpingBoot has fully inherited the Undertow technology, we only need to introduce the Undertow can rely, as shown below.

After configured, we start the application and found that the vessel has been replaced Undertow.

That is why we need to replace the Tomcat Undertow technology?

Tomcat and contrast the pros and cons of Undertow

Tomcat is a lightweight Servlet container under the Apache Foundation, supports Servlet and JSP. Tomcat Web server has unique features, including Tomcat management and control platform, security management bureau and Tomcat valve. Tomcat itself contains HTTP server, and therefore can be regarded as a separate Web server.

However, Tomcat and ApacheHTTP server is not a thing, ApacheHTTP server is HTTP Web server using C language. Tomcat is completely free, loved by developers.

Undertow is Red Hat's open source product, developed entirely in Java language, is a flexible, high-performance Web server, supports blocking and non-blocking IO IO. Since Undertow using Java language development, can be embedded directly into Java used in the project. Meanwhile, Undertow fully supports Servlet and Web Socket, under high concurrency performance is excellent.

We configured the pressure measured in the same machine Undertow Tomcat and obtained test results are shown below:

QPS comparing the test results:

Tomcat

Undertow

Memory Usage Comparison:

Tomcat

Undertow

Test found in highly concurrent systems, Tomcat relatively weak. Arranged in the same machine, analog equal number of requests, Undertow performance and memory use is optimal. And Undertow The new version uses a persistent connection by default, which will further improve its concurrent throughput. So, if the business is highly concurrent systems, Undertow is the best choice.

At last

SpingBoot we can either use Tomcat as a Http service can also be used Undertow instead. Undertow high concurrent business scenario, performance is better than Tomcat. So, if our system is a high concurrent requests, may wish to use it Undertow, you will find that your system performance will be greatly improved.

Published 58 original articles · won praise 4 · Views 3888

Guess you like

Origin blog.csdn.net/WANXT1024/article/details/104284226