Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up Undertow for Spring Boot

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "Spring Boot how to set Undertow", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "Spring Boot how to set Undertow"!

Tomcat container in Spring Boot

Spring Boot is arguably the hottest Java Web framework out there. It frees developers from the burden of XML and allows them to create a complete Web service in minutes, greatly improving developer productivity. Web container technology is an essential part of Web projects, because any Web project needs container technology to run. In the Spring Boot framework, we use Tomcat the most, which is the default container technology of Spring Boot, and Tomcat is embedded.

Spring Boot Settings Undertow

Java programmers should be familiar with Tomcat technology, which is the most commonly used container technology for Web applications. Our earliest development projects were basically deployed under Tomcat, so in addition to Tomcat container, what container technology can we use in Spring Boot? Yes, it is the Undertow container technology in the title. Srping Boot has completely inherited the Undertow technology, we only need to introduce the dependency of Undertow, as shown in the following figure.

Once configured, we launch the application and discover that the container has been replaced with Undertow.

So why do we need to replace Tomcat with Undertow technology?

Tomcat vs Undertow

Tomcat is a lightweight Servlet container under the Apache Foundation that supports Servlets and JSPs. Tomcat has Web server-specific features, including Tomcat administration and control platform, security bureau administration, and Tomcat valves. Tomcat itself contains the HTTP server, so it can also be considered a separate Web server. Tomcat and Apache HTTP server are not the same thing, Apache HTTP server is HTTP Web server implemented in C language. Tomcat is completely free and popular with developers.

Undertow is an open source product from Red Hat, developed entirely in Java, and is a flexible, high-performance Web server that supports both blocking and non-blocking IO. Because Undertow is developed in Java language, it can be directly embedded into Java projects. At the same time, Undertow fully supports Servlet and Web Socket and performs very well in high concurrency situations.

We pressed Tomcat and Undertow on the same machine configuration and got the following test results:

Comparison of QPS test results:

Tomcat

Undertow

Memory usage comparison:

Tomcat

Undertow

Tomcat is relatively weak in high concurrency systems, as tested. Undertow is optimal in terms of performance and memory usage for the same machine configuration, simulating an equal number of requests. And the new version of Undertow uses persistent connections by default, which will further improve its concurrency throughput. Therefore, if it is a highly concurrent business system, Undertow is the best choice.

Thank you for reading, the above is the "Spring Boot how to set Undertow" content, after the study of this article, I believe we have a deeper understanding of how to set Undertow Spring Boot this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report