Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-39338

excessive memory usage inside realmRoleGroupCache values



    • Previous Issue Keys:


      RealmRoleGroupCache was introduced via KNL-600 for Kernel 1.3 tag for Sakai 2.9.

      We have observed increasing memory usage problems with Sakai 2.9 code. In Yourkit, the RealmRoleGroupCache objects are on the top list of "Strong reachable" objects sorted by retained size.

      Please see the attached image for the object sizes used in the realmRoleGroup cache. Basically, for each cache key (realm id), the cache contains all the roles definition, and all the realm member user id, WITH its ROLE definition again.

      In the screenshot, one can see the ROLE object occupies 7K for each realm user been cached, compared to a String value of hundred bytes if the role id is used instead. This maybe a waste of large memory if dealing with 100x or 1000x realm members.

      Once the realmRoleGroup cache object is allocated, it would remain in the memory unless there is an eviction due to space limit. However, the default setting of maxEntriesLocalHeap is 125000, which is a pretty big value. In CTools, the count of this cache is below 25K after one week's usage.

      Though the cached value would get refreshed if it is hit after expiration time (3600s according to the default setting), it would never give up the space used. We think this is the major cause of the memory usage problem for our prod server nowadays.

        Gliffy Diagrams



            1. KNL-1037.diff
              4 kB
            2. KNL-1037.patch.txt
              4 kB
            3. realmRoleCache.tiff
              407 kB

              Issue Links



                  • Assignee:
                    aaronz Aaron Zeckoski (Inactive)
                    zqian Zhen Qian
                  • Votes:
                    0 Vote for this issue
                    9 Start watching this issue


                    • Created:

                      Git Integration