- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Performance Tuning
        Phillip Webb edited this page Jun 8, 2020 
        ·
        1 revision
      
    Tracking down performance regressions when developing Spring Boot can be challenging. This page documents some techniques that we occasionally use.
The spring-boot-sample-tomcat and spring-boot-sample-actuator-ui projects are good first candidates. There’s also spring-boot-startup-bench. Changing the main method to call .close() helps with repeated launching:
public static void main(String[] args) throws Exception {
   SpringApplication.run(SampleTomcatApplication.class, args).close();
}Startup speed can suffer if too many GC pauses happen. This can be a pain to track down because a relatively small change might suddenly push the memory limits.
Printing GC can be a useful way to see what’s changed between versions:
java -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -jar target/*.jar | grep GC