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

Eliminate synchronization contention on initial index reading in TermInfosReader ensureIndexIsRead

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.9
    • 2.9
    • core/index
    • None
    • Solr
      Tomcat 5.5
      Ubuntu 2.6.20-17-generic
      Intel(R) Pentium(R) 4 CPU 2.80GHz, 2Gb RAM

    • New

    Description

      synchronized method ensureIndexIsRead in TermInfosReader causes contention under heavy load

      Simple to reproduce: e.g. Under Solr, with all caches turned off, do a simple range search e.g. id:[0 TO 999999] on even a small index (in my case 28K docs) and under a load/stress test application, and later, examining the Thread dump (kill -3) , many threads are blocked on 'waiting for monitor entry' to this method.

      Rather than using Double-Checked Locking which is known to have issues, this implementation uses a state pattern, where only one thread can move the object from IndexNotRead state to IndexRead, and in doing so alters the objects behavior, i.e. once the index is loaded, the index nolonger needs a synchronized method.

      In my particular test, this uncreased throughput at least 30 times.

      Attachments

        1. LUCENE-1609.patch
          3 kB
          Dan Rosher
        2. LUCENE-1609.patch
          3 kB
          Dan Rosher
        3. LUCENE-1609.patch
          50 kB
          Michael McCandless
        4. LUCENE-1609.patch
          44 kB
          Michael McCandless

        Issue Links

          Activity

            People

              mikemccand Michael McCandless
              rosher Dan Rosher
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: