Yannick Welsch created LUCENE-9264:
--------------------------------------

             Summary: Remove SimpleFSDirectory in favor of NIOFsDirectory
                 Key: LUCENE-9264
                 URL: https://issues.apache.org/jira/browse/LUCENE-9264
             Project: Lucene - Core
          Issue Type: Improvement
            Reporter: Yannick Welsch


{{SimpleFSDirectory}} looks to duplicate what's already offered by 
{{NIOFsDirectory}}. The only difference is that {{SimpleFSDirectory}} is using 
non-positional reads on the {{FileChannel}} (i.e., reads that are stateful, 
changing the current position), and {{SimpleFSDirectory}} therefore has to 
externally synchronize access to the read method.

On Windows, positional reads are not supported, which is why {{FileChannel}} is 
already internally using synchronization to guarantee only access by one thread 
at a time for positional reads (see {{read(ByteBuffer dst, long position)}} in 
{{FileChannelImpl}}, and {{FileDispatcher.needsPositionLock}}, which returns 
true on Windows) and the JDK implementation for Windows is emulating positional 
reads by using non-positional ones, see 
[http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/windows/native/sun/nio/ch/FileDispatcherImpl.c#l139].

This means that on Windows, there should be no difference between 
{{NIOFsDirectory}} and {{SimpleFSDirectory}} in terms of performance (it should 
be equally poor as both implementations only allow one thread at a time to 
read). On Linux/Mac, {{NIOFsDirectory}} is superior to {{SimpleFSDirectory}}, 
however, as positional reads (pread) can be done concurrently.

My proposal is to remove {{SimpleFSDirectory}} and replace its uses with 
{{NIOFsDirectory}}, given how similar these two directory implementations are 
({{SimpleFSDirectory}} isn't really simpler).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to