Skip to content

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

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions