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

getBean(Class) lookup performance degredation [SPR-17282] #21815

Closed
spring-projects-issues opened this issue Sep 17, 2018 · 2 comments
Closed

getBean(Class) lookup performance degredation [SPR-17282] #21815

spring-projects-issues opened this issue Sep 17, 2018 · 2 comments
Assignees
Labels
in: core type: regression
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Sep 17, 2018

nytro77 opened SPR-17282 and commented

When upgrading from 5.0.9 to 5.1.0.RC3 i experienced severe performance degredation in some parts of an application that happens to call ApplicationContext.getBean(Class) many times in for loops.

I have reproduced the problem in the referenced project.

500k lookups of the same bean takes 1,5 seconds in 5.0.9 but 11 seconds in 5.1.0.RC3 on my computer.

When activating TRACE logging both versions prints Returning cached instance of singleton bean 'thebean' from org.springframework.beans.factory.support.DefaultListableBeanFactory  but something clearly has broken regarding the cache


Affects: 5.1 RC3

Reference URL: https://github.com/nytro77/spring-get-cached-bean-bug

Referenced from: commits c634b2f

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 18, 2018

Juergen Hoeller commented

While I don't see quite as dramatic a difference locally, there is definitely a regression in that we're bypassing the singletonBeanNamesByType cache for getBean(Class) calls now. This seems to be a side effect of a refactoring for getBeanProvider support (#21613); I'll fix it for 5.1 GA.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 18, 2018

Juergen Hoeller commented

This should be fixed in the upcoming 5.1.0.BUILD-SNAPSHOT now, just in time for Thursday's 5.1 GA release. Thanks for raising it in such a timely manner!

@spring-projects-issues spring-projects-issues added type: regression in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1 GA 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 type: regression
Projects
None yet
Development

No branches or pull requests

2 participants