-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Avoid repeated superclass introspection in AnnotationUtils.findAnnotation [SPR-16730] #21271
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
Comments
Juergen Hoeller commented I suppose you have common stacktraces that are calling into |
Juergen Hoeller commented On review, this is very much the territory we've covered in #21216 for 5.0.5 already... primarily for Let's see whether and where remaining expense can be optimized still, without caching every lookup attempt. Ideally, remaining hotspots should be cached at the caller's end, for example in MVC annotation processing... not repeatedly calling into Please give the upcoming |
Marc Boudreault commented Here a typical call stack: Stack for this key
|
Marc Boudreault commented Here another one
|
Marc Boudreault commented Here some stats on how many times we avoided going deep through findAnnotation calls with NULL_ANNOTATION, just after a few clicks on the application (no smoking test here)
|
Marc Boudreault commented Thx for addressing this quickly. Will give it a try as soon as possible. |
Juergen Hoeller commented Interesting, so it's primarily sorting by order annotations. I wouldn't have expected that to show up so strongly. I'll see what we can do about locally caching annotation-determined order values in |
Marc Boudreault commented I have retested with latest 5.0.6 spring version and findAnnotations still shows on top of the list, where as, with the null cache patch it uses almost no cpu. !image-2018-06-04-16-21-39-314.png! |
Juergen Hoeller commented I'm finally sorting out the |
Marc Boudreault commented We have upgraded to spring 5.1.1 and I can confirm the issue is fixed. Thx! |
Marc Boudreault opened SPR-16730 and commented
Hello,
We ran load tests and found that findAnnotation was one of the top method using CPU despite it uses caching.
We could correct this situation by caching NULL values with this simple change:
Often findAnnotation returns null - adding a key with NULL_ANNOTATION as the value resolved the issue. NULL_ANNOTATION is reverted to null prior returning.
After this change we observed an appreciable 4-5% performance improvement in our app across the board.
Affects: 4.3.10
Issue Links:
Referenced from: commits d78e27f, 26652a6
The text was updated successfully, but these errors were encountered: