lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toke Eskildsen>
Subject RE: how to "load" mmap directory into memory?
Date Wed, 03 Dec 2014 07:25:04 GMT
Li Li [] wrote:
> I am using mmap fs directory in lucene. My index is small (about 3GB
> in disk) and I have plenty of memory available. The problem is that
> when the term is first queried, it's slow. How can I "load" all
> directory into memory?

Yes. One of the smart things about MMap is that it is shared with the disk cache, so as long
as you read the bytes somehow, for example with the Java program you suggest, it will be available
in memory for Lucene.

On linux, the simplest is to 'cat myindexfolder/* > /dev/null'. Do not use 'cp' as it is
smart enough to bypass the operation if the destination is /dev/null.

Caveat: This does not guarantee that your index stays fully cached. It can be evicted just
like all other disk cache, if other programs perform enough disk operations.

- Toke Eskildsen

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message