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
Investigate Spring Web Services performance when using a fat jar #3640
Comments
My own testing with JMeter does show a performance difference, but nothing like that which is reported in the question. Someone's very kindly done some analysis in an answer on StackOverflow. The problem stems from a very inefficient SAAJ implementation in the JRE:
Finding the services entails calling |
When nested jars are being used, hasMoreElements requires opening a connection for an entry in every nested jar. If that entry doesn't exist, a FileNotFoundException is thrown to indicate that a particular jar doesn't contain the requested entry. This exception is used to indicate the lack of an entry and is then swallowed, i.e. its stack trace is of no importance. This means that the performance of hasMoreElements can be improved by switching on fast exceptions while it's being called. When fast exceptions are switched on a general purpose pre-initialized FileNotFoundException is thrown rather than creating a new FileNotFoundException instance each time. In certain situations, the use of fast exceptions as described above can improve performance fairly significantly. The JRE's default SAAJ implementation uses META-INF/services-based discovery for _every_ request that's handled by Spring Web Services. Each discovery attempt results in hasMoreElements being called making its performance critical to throughput. See gh-3640
👍 Nice, that exception trick solved similar issues in 1.x |
Some libraries like aspectj are using findResource to see the raw bytecode of a class. It will even call findResource for every method of every class of beans that are post processed. This can be significant performance hit on startup when LaunchedURLClassLoader and there are a lot of nested jars. Related spring-projectsgh-3640 Fix spring-projectsgh-4557
Some libraries like aspectj are using findResource to see the raw bytecode of a class. It will even call findResource for every method of every class of beans that are post processed. This can be significant performance hit on startup when LaunchedURLClassLoader and there are a lot of nested jars. See gh-3640 Fixes gh-4557
Some libraries like aspectj are using findResource to see the raw bytecode of a class. It will even call findResource for every method of every class of beans that are post processed. This can be significant performance hit on startup when LaunchedURLClassLoader and there are a lot of nested jars. See gh-3640 Fixes gh-4557
Via this question on Stack Overflow,
java -jar
is reportedly noticeably slower thanmvn spring-boot:run
The text was updated successfully, but these errors were encountered: