Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7062

In ExpandoMetaClass, use lower concurrency level for rarely written maps to save memory

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.6, 2.4.0-beta-3
    • 2.3.8
    • None
    • None
    • Patch

    Description

      The 5 ConcurrentHashMap's in ExpandoMetaClass are very rarely updated, and when they are, it's usually not by multiple concurrent threads. Therefore, using a lower concurrency level would result in less memory being used with no performance penalty. Since there are so many ExpandoMetaClass instances in a running application, this per instance savings is significant for a whole application.

      https://www.youtube.com/watch?v=fFpBfrSVvpM talks about Twitter encountering and solving this same problem.

      Documentation at http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html The default level is 16 which is massive overkill for these cases.

      Attachments

        Activity

          People

            melix Cédric Champeau
            candrews Craig
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: