Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-11776

Reduce memory usage of faceted navigation

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • High
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Flagged

    Description

      The FacetedNavigationEngineImpl uses two main caches: filterCache and facetValueCountCache.

      The facetValueCountCache uses as key the FVCKey inner class which stores all the keyObjects in an array just to calculate the hashcode. The keyObjects array can be easily in the 100s of kB and with a cache size of 1000 that will result in the 100s of MB of heap usage, just to calculate the hash code of the keys of the cache. The attached POC patch , pre-calculates and stores the hash code instead of the keyObjects array. Since the cache is now very small I increased to cache size from 1000 to 5000 and it still stays under 1 MB in total. But I have to admin that 5000 is as arbitrary as 1000.

      The filterCache caches CachingMultiReaderQueryFilter object which can be in the 100s of kB each since the CachingMultiReaderQueryFilter also contains a cache. I don't see much opportunity to reduce the memory footprint of the CachingMultiReaderQueryFilter, so the only option here is to reduce the cache size from 1000 to 200.

      For a real world prod example the patch results in an overall heap memory usage reduction of around 800MB by reducing the facetValueCountCache mem usage from some 400MB to 1MB and the filterCache from some 400 MB to around 100 MB.

      Other improvements:

      • use more efficient caching strategies like LRU?
      • make cache sizes and TTL settings configurable

      Attachments

        Issue Links

          Activity

            People

              aschrijvers Ard Schrijvers
              bvdschans Bart van der Schans (Inactive)
              Hippo Helpdesk Hippo Helpdesk
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: