Skip to content

Revisit class cache in CachedIntrospectionResults [SPR-11867] #16486

Closed

Description

@spring-projects-issues

Lari Hotari opened SPR-11867 and commented

I'm doing performance tuning with Grails 2.4.1.BUILD-SNAPSHOT which uses Spring 4.0.5 .

The main principle for performance tuning in Grails is to minimize all blocking. I rely on the profiler information about what's causing the most blocking.

After eliminating the blocking problem in AbstractApplicationContext.assert (reported as #16482 , comments in SPR-10307) by simply overriding assertBeanFactoryActive with a no-op method in a subclass of GenericApplicationContext, the top-most blocker is now org.springframework.beans.CachedIntrospectionResults.forClass(Class) method.


Affects: 3.2.9, 4.0.5

Issue Links:

Referenced from: commits f27b949, 8307447, fab67b0

Backported to: 3.2.10

Activity

  1. spring-projects-issues commented on Jun 11, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Lari Hotari commented

    In my performance test , this is a very minor source of blocking compared to #16482 (the relative amount of blocking this causes is not even comparable). YMMV :)

  2. spring-projects-issues commented on Jun 12, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Stéphane Nicoll commented

    Do you know what this does and do you really need this? I know this may not fix the actual performance issue you found but you can disable it (see #13653)

  3. spring-projects-issues commented on Jun 29, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    CachedIntrospectionResults, GenericTypeAwarePropertyDescriptor and BeanUtils consistently avoid synchronization now. This is a little bit risky since we're using our ConcurrentReferenceHashMap in those very hotspot places now, which is why this is not really a candidate for backporting. Let's rather use the 4.1 release candidate phase to have this tested in many scenarios.

    As a side effect, through ConcurrentReferenceHashMap, we're using soft references for non-cache-safe bean classes now. Previously, we used weak references even for the CachedIntrospectionResults reference which led to rather aggressive garbage collection effects. We should consider changing that part to soft references in 4.0.6 and 3.2.10 as well, simply storing them in the existing WeakHashMap there.

    Juergen

  4. spring-projects-issues commented on Jul 1, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Backporting the change to SoftReference values as mentioned above. The synchronization-free use of ConcurrentReferenceHashMap remains 4.1 only.

    Juergen

  5. added
    status: backported
    type: enhancement
    on Jan 11, 2019
  6. added this to the 4.0.6 milestone 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

status: backportedtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions