[jira] Created: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

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

[jira] Created: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
Use NIO positional read to avoid synchronization in FSIndexInput
----------------------------------------------------------------

                 Key: LUCENE-753
                 URL: http://issues.apache.org/jira/browse/LUCENE-753
             Project: Lucene - Java
          Issue Type: New Feature
          Components: Store
            Reporter: Yonik Seeley


As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

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

Yonik Seeley updated LUCENE-753:
--------------------------------

    Attachment: FSIndexInput.patch

Patch for FSIndexInput to use a positional read call that doesn't use explicit synchronization.  Note that the implementation of that read call may still involve some synchronization depending on the JVM and OS (notably Windows which lacks a native pread AFAIK).

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459724 ]
           
Yonik Seeley commented on LUCENE-753:
-------------------------------------

This change should be faster on heavily loaded multi-threaded servers using the non-compound index format.
Performance tests are needed to see if there is any negative impact on single-threaded performance.

Compound index format (CSIndexInput) still does synchronization because the base IndexInput is not cloned (and hence shared by all CSIndexInput clones).  It's unclear if getting rid of the synchronization is worth the cloning overhead in this case.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459731 ]
           
Doug Cutting commented on LUCENE-753:
-------------------------------------

This patch continues to use BufferedIndexInput and allocates a new ByteBuffer for each call to read().  I wonder if it might be more efficient to instead directly extend IndexInput and always represent the buffer as a ByteBuffer?

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459805 ]
           
Yonik Seeley commented on LUCENE-753:
-------------------------------------

CSIndexInput synchronization could also be elimitated if there was a pread added to IndexInput

  public abstract void readBytes(byte[] b, int offset, int len, long fileposition)

Unfortunately, that would break any custom Directory based implementations out there, and we can't provide a suitable default with seek & read because we don't know what object to synchronize on.
Worth it or not???

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

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

Re: [jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

Robert Engels
That is what I did in my implementation.

It is easy to implement this as a protected abstract method in  
IndexInput, which uses synchronization (and seek(), read(byte
[],off,len). In the 'real" version just override it to do it properly  
without using seek().




On Dec 19, 2006, at 7:40 PM, Yonik Seeley (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/LUCENE-753?
> page=comments#action_12459805 ]
>
> Yonik Seeley commented on LUCENE-753:
> -------------------------------------
>
> CSIndexInput synchronization could also be elimitated if there was  
> a pread added to IndexInput
>
>   public abstract void readBytes(byte[] b, int offset, int len,  
> long fileposition)
>
> Unfortunately, that would break any custom Directory based  
> implementations out there, and we can't provide a suitable default  
> with seek & read because we don't know what object to synchronize on.
> Worth it or not???
>
>> Use NIO positional read to avoid synchronization in FSIndexInput
>> ----------------------------------------------------------------
>>
>>                 Key: LUCENE-753
>>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>>             Project: Lucene - Java
>>          Issue Type: New Feature
>>          Components: Store
>>            Reporter: Yonik Seeley
>>         Attachments: FSIndexInput.patch
>>
>>
>> As suggested by Doug, we could use NIO pread to avoid  
>> synchronization on the underlying file.
>> This could mitigate any MT performance drop caused by reducing the  
>> number of files in the index format.
>
> --
> 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]
>


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

Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

Yonik Seeley-2
On 12/19/06, robert engels <[hidden email]> wrote:
> That is what I did in my implementation.
>
> It is easy to implement this as a protected abstract method in
> IndexInput, which uses synchronization (and seek(), read(byte
> [],off,len). In the 'real" version just override it to do it properly
> without using seek().

You can synchronize and protect other calls to that same pread method,
but it breaks if it's called concurrently with most other methods
because they aren't synchronized.  It's not "thread-safe" in the
normal sense of the word.

One would have to specify that if you were going to use an IndexInput
from multiple threads at once, that you could *only* use the pread
method, and pretty much no others without external synchronization.
That's doable I guess, but complicated to try to explain to others.

-Yonik


>
> On Dec 19, 2006, at 7:40 PM, Yonik Seeley (JIRA) wrote:
>
> >     [ http://issues.apache.org/jira/browse/LUCENE-753?
> > page=comments#action_12459805 ]
> >
> > Yonik Seeley commented on LUCENE-753:
> > -------------------------------------
> >
> > CSIndexInput synchronization could also be elimitated if there was
> > a pread added to IndexInput
> >
> >   public abstract void readBytes(byte[] b, int offset, int len,
> > long fileposition)
> >
> > Unfortunately, that would break any custom Directory based
> > implementations out there, and we can't provide a suitable default
> > with seek & read because we don't know what object to synchronize on.
> > Worth it or not???
> >
> >> Use NIO positional read to avoid synchronization in FSIndexInput
> >> ----------------------------------------------------------------
> >>
> >>                 Key: LUCENE-753
> >>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
> >>             Project: Lucene - Java
> >>          Issue Type: New Feature
> >>          Components: Store
> >>            Reporter: Yonik Seeley
> >>         Attachments: FSIndexInput.patch
> >>
> >>
> >> As suggested by Doug, we could use NIO pread to avoid
> >> synchronization on the underlying file.
> >> This could mitigate any MT performance drop caused by reducing the
> >> number of files in the index format.
> >

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

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

Yonik Seeley updated LUCENE-753:
--------------------------------

    Attachment: FSIndexInput.patch

Here is a patch that directly extends IndexInput to make things a little easier.
I started with the code for BufferedIndexInput to avoid any bugs in read().
They share enough code that a common subclass could be factored out if desired (or changes made in BufferedIndexInput to enable easier sharing).

ByteBuffer does have offset, length, etc, but I did not use them because BufferedIndexInput currently allocates the byte[] on demand, and thus would add additional checks to readByte().  Also, the NIO Buffer.get() isn't as efficient as our own array access.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459868 ]
           
Bogdan Ghidireac commented on LUCENE-753:
-----------------------------------------

You can find a NIO variation of IndexInput attached to this issue: http://issues.apache.org/jira/browse/LUCENE-519

I had good results on multiprocessor machines under heavy load.

Regards,
Bogdan

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459967 ]
           
Yonik Seeley commented on LUCENE-753:
-------------------------------------

Thanks for the pointer Bogdan, it's interesting you use transferTo instead of read... is there any advantage to this?  You still need to create a new object every read(), but at least it looks like a smaller object.

It's also been pointed out to me that http://issues.apache.org/jira/browse/LUCENE-414 has some more NIO code.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12459971 ]
           
Bogdan Ghidireac commented on LUCENE-753:
-----------------------------------------

The Javadoc says that transferTo can be more efficient because the OS can transfer bytes directly from the filesystem cache to the target channel without actually copying them.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12460289 ]
           
Yonik Seeley commented on LUCENE-753:
-------------------------------------

> The Javadoc says that transferTo can be more efficient because the OS can transfer bytes
> directly from the filesystem cache to the target channel without actually copying them.

Unfortunately, only for DirectByteBuffers and other FileChannels, not for HeapByteBuffers.
Sounds like we just need to do some benchmarking, but I have a bad feeling that all the checking overhead Sun added to NIO will cause it to be slower in the single threaded case.


> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

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

Yonik Seeley updated LUCENE-753:
--------------------------------

    Attachment: FileReadTest.java

Attaching test that reads a file in different ways, either random access or serially, from a number of threads.


> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-753?page=comments#action_12460363 ]
           
Yonik Seeley commented on LUCENE-753:
-------------------------------------

Single-threaded random access performance of a fully cached 64MB file on my home PC (WinXP) , Java6:

config: impl=ClassicFile serial=false nThreads=1 iterations=200 bufsize=1024 filelen=6518936
answer=81332126, ms=7781, MB/sec=167.5603649916463

config: impl=ChannelFile serial=false nThreads=1 iterations=200 bufsize=1024 filelen=6518936
answer=81332126, ms=9203, MB/sec=141.66980332500273

config: impl=ChannelPread serial=false nThreads=1 iterations=200 bufsize=1024 filelen=6518936
answer=81332126, ms=11672, MB/sec=111.70212474297463

config: impl=ChannelTransfer serial=false nThreads=1 iterations=200 bufsize=1024 filelen=6518936
answer=81332126, ms=17328, MB/sec=75.2416435826408

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: http://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
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-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/LUCENE-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549869 ]

Brian Pinkerton commented on LUCENE-753:
----------------------------------------

Most of my workloads would benefit by removing the synchronization in FSIndexInput, so I took a closer look at this issue.  I found exactly the opposite results that Yonik did on two platforms that I use frequently in production (Solaris and Linux), and by a significant margin.  I even get the same behavior on the Mac, though I'm not running Java6 there.

# uname -a
Linux xxx 2.6.9-22.0.1.ELsmp #1 SMP Tue Oct 18 18:39:27 EDT 2005 i686 i686 i386 GNU/Linux
# java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

config: impl=ChannelPread serial=false nThreads=200 iterations=10 bufsize=1024 filelen=10485760
answer=0, ms=88543, MB/sec=236.85124741650947
config: impl=ClassicFile serial=false nThreads=200 iterations=10 bufsize=1024 filelen=10485760
answer=0, ms=150560, MB/sec=139.29011689691816



# uname -a
SunOS xxx 5.10 Generic_118844-26 i86pc i386 i86pc
# java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

config: impl=ChannelPread serial=false nThreads=200 iterations=10 bufsize=1024 filelen=10485760
answer=0, ms=39621, MB/sec=529.3031473208652

config: impl=ClassicFile serial=false nThreads=200 iterations=10 bufsize=1024 filelen=10485760
answer=0, ms=119057, MB/sec=176.14688762525515



> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

Robert Engels
I posted a bug on this to Sun a long while back.

NIO preads actually sync behind the scenes on some platforms.  Using  
multiple file descriptors is much faster.

See bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265734


On Dec 9, 2007, at 6:24 PM, Brian Pinkerton (JIRA) wrote:

>
>     [ https://issues.apache.org/jira/browse/LUCENE-753?
> page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
> tabpanel#action_12549869 ]
>
> Brian Pinkerton commented on LUCENE-753:
> ----------------------------------------
>
> Most of my workloads would benefit by removing the synchronization  
> in FSIndexInput, so I took a closer look at this issue.  I found  
> exactly the opposite results that Yonik did on two platforms that I  
> use frequently in production (Solaris and Linux), and by a  
> significant margin.  I even get the same behavior on the Mac,  
> though I'm not running Java6 there.
>
> # uname -a
> Linux xxx 2.6.9-22.0.1.ELsmp #1 SMP Tue Oct 18 18:39:27 EDT 2005  
> i686 i686 i386 GNU/Linux
> # java -version
> java version "1.6.0_02"
> Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
> Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)
>
> config: impl=ChannelPread serial=false nThreads=200 iterations=10  
> bufsize=1024 filelen=10485760
> answer=0, ms=88543, MB/sec=236.85124741650947
> config: impl=ClassicFile serial=false nThreads=200 iterations=10  
> bufsize=1024 filelen=10485760
> answer=0, ms=150560, MB/sec=139.29011689691816
>
>
>
> # uname -a
> SunOS xxx 5.10 Generic_118844-26 i86pc i386 i86pc
> # java -version
> java version "1.6.0"
> Java(TM) SE Runtime Environment (build 1.6.0-b105)
> Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
>
> config: impl=ChannelPread serial=false nThreads=200 iterations=10  
> bufsize=1024 filelen=10485760
> answer=0, ms=39621, MB/sec=529.3031473208652
>
> config: impl=ClassicFile serial=false nThreads=200 iterations=10  
> bufsize=1024 filelen=10485760
> answer=0, ms=119057, MB/sec=176.14688762525515
>
>
>
>> Use NIO positional read to avoid synchronization in FSIndexInput
>> ----------------------------------------------------------------
>>
>>                 Key: LUCENE-753
>>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>>             Project: Lucene - Java
>>          Issue Type: New Feature
>>          Components: Store
>>            Reporter: Yonik Seeley
>>         Attachments: FileReadTest.java, FSIndexInput.patch,  
>> FSIndexInput.patch
>>
>>
>> As suggested by Doug, we could use NIO pread to avoid  
>> synchronization on the underlying file.
>> This could mitigate any MT performance drop caused by reducing the  
>> number of files in the index format.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/LUCENE-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550078 ]

Yonik Seeley commented on LUCENE-753:
-------------------------------------

Brad, one possible difference is the number of threads we tested with.
I tested single-threaded (nThreads=1) to see what kind of slowdown a single query might see.

A normal production  system shouldn't see 200 concurrent running search threads unless it's just about to fall over, or unless it's one of those massive multi-core systems.  After you pass a certain amount of parallelism, NIO can help.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/LUCENE-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550128 ]

Brian Pinkerton commented on LUCENE-753:
----------------------------------------

Whoops; I should have paid more attention to the args.  The results in the single-threaded case still favor pread, but by a slimmer margin:

Linux:

config: impl=ClassicFile serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=0, ms=9983, MB/sec=210.0723229490133

config: impl=ChannelPread serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=0, ms=9247, MB/sec=226.7926895209257


Solaris 10:

config: impl=ClassicFile serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=0, ms=7381, MB/sec=284.12843788104595

config: impl=ChannelPread serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=0, ms=6245, MB/sec=335.81297037630105


Mac OS X:

config: impl=ChannelPread serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=-914995, ms=19945, MB/sec=105.14675357232389

config: impl=ClassicFile serial=false nThreads=1 iterations=200 bufsize=1024 filelen=10485760
answer=-914995, ms=26378, MB/sec=79.50382894836606



> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/LUCENE-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550130 ]

Doug Cutting commented on LUCENE-753:
-------------------------------------

> Brad, [...]

That's Brian.  And right, the difference in your tests is the number of threads.

Perhaps this is a case where one size will not fit all.  MmapDirectory is fastest on 64-bit platforms with lots of threads, while good-old-FSDirectory has always been fastest for single-threaded access.  Perhaps a PreadDirectory would be the Directory of choice for multi-threaded access of large indexes on 32-bit hardware?  It would be useful to benchmark this patch against MmapDirectory, since they both remove synchronization.

> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-753) Use NIO positional read to avoid synchronization in FSIndexInput

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/LUCENE-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550135 ]

Doug Cutting commented on LUCENE-753:
-------------------------------------

My prior remarks were posted before I saw Brian's latest benchmarks.

While it would still be good to throw mmap into the mix, pread now looks like a strong contender for the one that might beat all.  It works well on 32-bit hardware, it's unsynchronized, and it's fast.  What's not to like?


> Use NIO positional read to avoid synchronization in FSIndexInput
> ----------------------------------------------------------------
>
>                 Key: LUCENE-753
>                 URL: https://issues.apache.org/jira/browse/LUCENE-753
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Store
>            Reporter: Yonik Seeley
>         Attachments: FileReadTest.java, FSIndexInput.patch, FSIndexInput.patch
>
>
> As suggested by Doug, we could use NIO pread to avoid synchronization on the underlying file.
> This could mitigate any MT performance drop caused by reducing the number of files in the index format.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

12345