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

ReflectionUtils slow down application startup on WebSphere [SPR-11882] #16501

Closed
spring-projects-issues opened this issue Jun 17, 2014 · 2 comments
Closed
Assignees
Labels
in: core status: backported type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 17, 2014

Anton Zukovskij opened SPR-11882 and commented

On WebSphere application server (multi-node config) spring context initialization is very slow, our application has big classpath that causes classloader to be quite slow(see WAS_startup.png). After adding cache to ReflectionUtils.findMethod and AnnotationUtils.findAnnotation (see patch.patch) spring context seems to initialize a lot faster (see ReflectionUtils.png and AnnotationUtils.png).


Affects: 3.1.1, 3.2.4

Attachments:

Issue Links:

  • #12286 Major performance slowdown in AnnotationUtils.findAnnotation
  • #16494 Performance regression for custom autowireBean calls with many properties
  • #17476 AnnotationUtils should use threadsafe ConcurrentMap (contention)
  • #17419 Make ReflectionUtils.doWithMethods work on Java 8 default interface methods
  • #21216 Comprehensively cache annotated methods for interfaces and superclasses
  • #18357 ReflectionUtils cache uses up a fairly big chunk of heap even
  • #21271 Avoid repeated superclass introspection in AnnotationUtils.findAnnotation
  • #14830 Improve performance of ReflectionUtils#getUniqueDeclaredMethods

Referenced from: commits 0298a1f, 5f695a4, 682a910

Backported to: 3.2.10

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 27, 2014

Juergen Hoeller commented

Thanks for pointing this out! We weren't aware that this can be such a hotspot; it's a shame that the JVM itself isn't better at caching reflection results there.

So ReflectionUtils caches Class.getDeclaredMethods() results now, as suggested. AnnotationUtils caches findAnnotation results both for classes and for methods, along the lines of what you suggested.

That said, it's not yet decided how much of this is going to be backported. The ReflectionUtils change seems like an obvious candidate for both 4.0.6 and 3.2.10 next week; however, the AnnotationUtils change leads to a harder-to-predict memory consumption profile, so it might fit for 4.0.6 still but not so much for 3.2.10, I'm afraid.

What do your upgrade plans look like? Are you aware that you can upgrade to Spring Framework 4.x even when deploying to WebSphere 7?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 27, 2014

Anton Zukovskij commented

We've added a patched version of spring-core to our application, so we can wait for 3.2.10. As for 4.x upgrade, our project uses over 40 000 beans so we need to plan this separately.
Thank you for quick response :)

@spring-projects-issues spring-projects-issues added status: backported type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.6 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: backported type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants