Spring Boot Change Servlet Container To Undertow

摘自:

https://alexecollins.com/spring-boot-performance/

By default, Spring Boot uses Tomcat. Tomcat uses around 110mb of heap, and has ~16 threads:



 

Undertow is a lightweight servlet container from JBoss. You can switch to Undertow to get a performance improvement. Firstly, exclude Tomcat from your dependencies:

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

Add Undertow:

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

Undertow uses around 90MB and has ~13 threads:



 

Conclusion【结论】

These are a few small tips on improving the performance of your Spring Boot applications. The benefits are smaller for smaller applications, but for larger applications can quickly become pronounced. Try it out and tell me what you think.

 

 

 

 

 

 

 

 

 

 

 

 

猜你喜欢

转载自huangqiqing123.iteye.com/blog/2421856