Skip to content

Non-singleton beans performance issue [SPR-9819] #14452

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

Closed
spring-projects-issues opened this issue Sep 22, 2012 · 1 comment
Closed

Non-singleton beans performance issue [SPR-9819] #14452

spring-projects-issues opened this issue Sep 22, 2012 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 22, 2012

Andriy Rosa opened SPR-9819 and commented

For each method invocation for not-singleton scope bean
Interceptor got bean from bean-factory by using AbstractBeanFactory.getBean

But before getting required bean inside method getBean we have cheeking

Object sharedInstance = getSingleton(beanName);
if (sharedInstance != null && args == null) {

Inside getSingleton we have synchronized blocks.

considering that in high-load project we can have a lot of scoped-beans methods invocations, getSingleton lock all threads, and performance gone to very poor.

I'm not very good in spring-core architecture, however by my mean the most obvious solution - it push into args argument of getBean method specific arg, which will show, that we request not singleton bean for sure

P.S.: Take my apologies for my bad English.


Affects: 3.1.1

Issue Links:

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We've addressed this for 3.2 now, avoiding that singletonObjects lock wherever possible (i.e. just doing an efficient ConcurrentHashMap check).

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants