Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Plugin bootRun Optimizations Reduce Application Performance on Temurin-17 JDK #39741

Closed
locosmac opened this issue Feb 23, 2024 · 2 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@locosmac
Copy link

Hello everyone,

By default, the Spring Boot Gradle plugin performs an "optimized launch" when executing the bootRun task which appears to be adding "-XX:TieredStopAtLevel=1" as an optimization.

A student of mine wrote a Spring Boot application that first reads a 250MB GTFS file (i.e. a ZIP containing text files in CSV format) and then performs a large number of hash table lookups as part of its initialization. Due to this optimization, the CSV parsing is slower by a factor of approx. 4 and the performance of the hash table lookups decrease by a factor of approx. 200. I have tested this with JDK 17 on Windows and MacOS.

Of course, it is possible to configure bootRun with an "unoptimized launch" by setting optimizedLaunch to false, but I think that this optimization should probably be removed, at least for JDK 17 Termurin. As an alternative it might make sense to change the default for "optimizedLaunch" to false, since it takes to time to find issues like this when you are not actively enabling something that does not always work as expected.

Cheers,

Marcus

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 23, 2024
@wilkinsona
Copy link
Member

Both bootRun and spring-boot:run are focused on fast startup of the JVM:

By default, bootRun will configure the JVM to optimize its launch for faster startup during development.

This comes at the cost of potentially reduced peak performance. I think that's what you're seeing here and I don't think it's specific to any particular JVM.

As the documentation states, the goal is to speed things up during application development when starting the app occurs frequently. Where peak performance is required, the application should be started in a way that's intended for a "production" environment. That's often java -jar or java -cp with an exploded jar referencing Spring Boot's launcher or the application's main class directly.

I don't think we should change anything here. From what we've seen, your situation is atypical and I think the current defaults are working as documented and strike the right balance. Thanks anyway for raising your concerns.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2024
@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 23, 2024
@locosmac
Copy link
Author

Thank you for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants