Spring Boot Change Servlet Container To Undertow

Taken from:

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 【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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325983577&siteId=291194637