Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2075

Share the Term -> TermInfo cache across threads

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0-ALPHA
    • core/index
    • None
    • New

    Description

      Right now each thread creates its own (thread private) SimpleLRUCache,
      holding up to 1024 terms.

      This is rather wasteful, since if there are a high number of threads
      that come through Lucene, you're multiplying the RAM usage. You're
      also cutting way back on likelihood of a cache hit (except the known
      multiple times we lookup a term within-query, which uses one thread).
      In NRT search we open new SegmentReaders (on tiny segments) often
      which each thread must then spend CPU/RAM creating & populating.

      Now that we are on 1.5 we can use java.util.concurrent.*, eg
      ConcurrentHashMap. One simple approach could be a double-barrel LRU
      cache, using 2 maps (primary, secondary). You check the cache by
      first checking primary; if that's a miss, you check secondary and if
      you get a hit you promote it to primary. Once primary is full you
      clear secondary and swap them.

      Or... any other suggested approach?

      Attachments

        1. ConcurrentLRUCache.java
          20 kB
          Mark Miller
        2. LUCENE-2075.patch
          15 kB
          Yonik Seeley
        3. LUCENE-2075.patch
          15 kB
          Yonik Seeley
        4. LUCENE-2075.patch
          15 kB
          Yonik Seeley
        5. LUCENE-2075.patch
          16 kB
          Uwe Schindler
        6. LUCENE-2075.patch
          16 kB
          Uwe Schindler
        7. LUCENE-2075.patch
          25 kB
          Michael McCandless
        8. LUCENE-2075.patch
          12 kB
          Michael McCandless
        9. LUCENE-2075.patch
          12 kB
          Uwe Schindler
        10. LUCENE-2075.patch
          12 kB
          Michael McCandless
        11. LUCENE-2075.patch
          19 kB
          Michael McCandless
        12. LUCENE-2075.patch
          20 kB
          Michael McCandless
        13. LUCENE-2075.patch
          21 kB
          Michael McCandless

        Activity

          People

            mikemccand Michael McCandless
            mikemccand Michael McCandless
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: