Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3484

[perf] Use solr ConcurrentLRUCache instead Collections.synchronizedMap

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.13, 2.1.7
    • JSR-314
    • None

    Description

      Some tests shows that use Collections.synchronizedMap for create a LRU cache cause some contention.

      We have 3 places susceptibles for this optimization:

      • org.apache.myfaces.shared.resource.ResourceHandlerCache
      • org.apache.myfaces.shared.application.DefaultViewHandlerSupport
      • org.apache.myfaces.lifecycle.DefaultRestoreViewSupport

      Instead use Collections.synchronizedMap, we can use solr org.apache.solr.util.ConcurrentLRUCache. For example:

      _checkedViewIdMap = new ConcurrentLRUCache<String, Boolean>((maxSize * 4 + 3) / 3, maxSize);

      We set the lower mark on maxSize and the upper mark at 1.33 maxSize. Solr implementation is very good for these cases. In typical situations, user will set maxSize to a value that prevents cache cleanup.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: