Oct 5th, 2010, 06:35 AM
Jobs registration startup time increased with Spring 3
We recently switched our application to Spring 3.0.4. We are using Spring batch 2.1.3
What I've noticed is a big increase of the application startup time (28 sec with 2.5.7 and 43 sec with 3.0.4).
Has anybody experienced similar slow down? Any idea how this could be improved?
Oct 5th, 2010, 02:34 PM
I haven't heard of any problems with Batch, but there are similar issues with some apps loading XSD and DTD docs from the internet instead of the local jars. You could confirm if this is the problem by sniffing the network traffic as your app starts up (or maybe just shutting off the internet and see what happens).
Oct 6th, 2010, 08:43 AM
Another suggestion: if you are running on Unix there have been reports of slow start up when using Spring Security because of OS-level calls to generate random numbers. Are you using Spring Security on unix? Can you try the same test on Windows?
Oct 6th, 2010, 08:48 AM
Thanks for the heads up Dave. I am on windows and the company is behind an HTTP proxy that is not configured on my box (I mean for Java-based apps).
I have scheduled a profiling session tomorrow and I'll keep you posted.
Oct 7th, 2010, 08:13 AM
I have found something that might be interesting. It's not directly related to batch and I am ok to report it to the core framework directly.
I have ran a profiling session with our batch module and a simple test case. The test is empty but it bootstraps the container that holds 22 job definitions.
The yourkit snapshot are available if you're interested but it all boils down to registerItemListeners and registerStepListeners. With Spring 2.5, the call stack is fast but something changed in 3.0. The call to java.lang.class went from 14.000 invocations to 1.3 million !
See the call stack for the registerItemListeners
Spring 2.5: http://img243.imageshack.us/i/spring...egisterit.png/
Spring 3: http://img715.imageshack.us/i/spring...gisterite.png/
Oct 7th, 2010, 05:05 PM
I don't see the 1.3 million number anywhere, but I can see the difference between Spring 3 and 2.5 (the implementation of AnnotationUtils.findAnnotation(Method,Class) changed). Can you raise an issue against Spring Core and we can take it from there. It is possible we could do some caching.
Oct 8th, 2010, 02:18 AM
Here you go
(1,17M on the 1,30M are for the item/step registration process)
And the issue: https://jira.springframework.org/browse/SPR-7630
Oct 11th, 2010, 06:51 AM
An interesting outcome of my profiling session shows that the checks for annotations seems to be duplicated.
I haven't looked precisely at the code but maybe you'll find the information useful. You can find more information in SPR-7630.