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

[PATCH]Multiple threads performance enhancement when querying.

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.9
    • None
    • core/search
    • None
    • OS: Red Hat EL 3
      Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
      Lucene 1.9.1
      JVM:JDK1.5.06

    Description

      This improvement will reduce the wait when TermInfosReader calls ensureIndexIsRead().
      The small trick like below:
      ....
      private void ensureIndexIsRead() throws IOException {
      if (indexTerms != null) // index already read
      return; // do nothing
      synchronized(this){
      System.out.println("Read index@--@");
      if(indexTerms != null)

      { System.out.println ("Someone read it.return-_-"); return ; }

      readIndex ();
      }
      }

      private synchronized void readIndex() throws IOException{
      Term[] m_indexTerms = null;
      try {
      int indexSize = (int)indexEnum.size; // otherwise read index
      m_indexTerms = new Term[indexSize];
      indexInfos = new TermInfo[indexSize];
      indexPointers = new long[indexSize];

      for (int i = 0; indexEnum.next(); i++)

      { m_indexTerms[i] = indexEnum.term(); indexInfos[i] = indexEnum.termInfo(); indexPointers[i] = indexEnum.indexPointer; }

      } finally

      { indexEnum.close(); indexEnum = null; indexTerms = m_indexTerms; }

      }

      Attachments

        1. TermInfosReader.java
          7 kB
          Yueyu Lin

        Activity

          People

            yseeley@gmail.com Yonik Seeley
            popeyelin Yueyu Lin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment