[jira] Created: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.

JIRA jira@apache.org
[PATCH]Multiple threads performance enhancement when querying.
--------------------------------------------------------------

         Key: LUCENE-568
         URL: http://issues.apache.org/jira/browse/LUCENE-568
     Project: Lucene - Java
        Type: Improvement

  Components: Search  
    Versions: 1.9    
 Environment: OS: Red Hat EL 3
Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
Lucene 1.9.1
JVM:JDK1.5.06
    Reporter: Yueyu Lin


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;
        }
  }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.

JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-568?page=all ]

Yueyu Lin updated LUCENE-568:
-----------------------------

    Attachment: TermInfosReader.java

That attachment is the patched file.

> [PATCH]Multiple threads performance enhancement when querying.
> --------------------------------------------------------------
>
>          Key: LUCENE-568
>          URL: http://issues.apache.org/jira/browse/LUCENE-568
>      Project: Lucene - Java
>         Type: Improvement

>   Components: Search
>     Versions: 1.9
>  Environment: OS: Red Hat EL 3
> Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
> Lucene 1.9.1
> JVM:JDK1.5.06
>     Reporter: Yueyu Lin
>  Attachments: TermInfosReader.java
>
> 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;
>         }
>   }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-568?page=comments#action_12378819 ]

Otis Gospodnetic commented on LUCENE-568:
-----------------------------------------

Please provide a patch instead of the whole file, so your changes can be clearly seen.
Here is how to do it: http://wiki.apache.org/jakarta-lucene/HowToContribute


> [PATCH]Multiple threads performance enhancement when querying.
> --------------------------------------------------------------
>
>          Key: LUCENE-568
>          URL: http://issues.apache.org/jira/browse/LUCENE-568
>      Project: Lucene - Java
>         Type: Improvement

>   Components: Search
>     Versions: 1.9
>  Environment: OS: Red Hat EL 3
> Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
> Lucene 1.9.1
> JVM:JDK1.5.06
>     Reporter: Yueyu Lin
>  Attachments: TermInfosReader.java
>
> 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;
>         }
>   }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-568?page=all ]
     
Yonik Seeley closed LUCENE-568:
-------------------------------

    Resolution: Invalid
     Assign To: Yonik Seeley

I'm closing this improvement without commiting since the proposed change is in the form of a well known anti-pattern called double-checked locking. The bug is hard enough to spot and hard to test for correctness, so I'm afraid of leaving this bug open since others may patch their local versions.


> [PATCH]Multiple threads performance enhancement when querying.
> --------------------------------------------------------------
>
>          Key: LUCENE-568
>          URL: http://issues.apache.org/jira/browse/LUCENE-568
>      Project: Lucene - Java
>         Type: Improvement

>   Components: Search
>     Versions: 1.9
>  Environment: OS: Red Hat EL 3
> Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
> Lucene 1.9.1
> JVM:JDK1.5.06
>     Reporter: Yueyu Lin
>     Assignee: Yonik Seeley
>  Attachments: TermInfosReader.java
>
> 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;
>         }
>   }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]