Skip to content

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

Closed

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

Activity

  1. spring-projects-issues commented on Nov 8, 2012

    @spring-projects-issues
    CollaboratorAuthor

    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

  2. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions