Uploaded image for project: 'Lucene.Net'
  1. Lucene.Net
  2. LUCENENET-610

Reduce locking in FieldCacheImpl::Cache::Get

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Lucene.Net 4.8.0
    • Fix Version/s: None
    • Component/s: Lucene.Net Core
    • Labels:
      None

      Description

      We noticed a lot of contention in FieldCacheImpl::Cache::Get (our queries use a lot of query time joins + sorting, so we hit the field cache a lot).

      We use a SearcherManager with warm-up queries to populate the field cache so we would expect it to be initialized in most cases before we hit it for actual requests.

      The implementation seems to lock even for the happy path (when everything's already initialized). This seems like a by-product of the choice of data structures (the underlying WeakDictionary, WeakHashMap etc are not threadsafe) and so the locking is required in case the dictionary gets resized.

      Ideally we could be using thread-safe data structures and only lock when initializing the data.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sthmathew Thomas Mathew
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: