lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brettgleeso...@gmail.com
Subject Re: how to "load" mmap directory into memory?
Date Wed, 03 Dec 2014 14:17:44 GMT
"Indin _bull?
Sent from my BlackBerry® wireless device

-----Original Message-----
From: Toke Eskildsen <te@statsbiblioteket.dk>
Date: Wed, 3 Dec 2014 08:25:04 
To: java-user@lucene.apache.org<java-user@lucene.apache.org>
Reply-To: java-user@lucene.apache.org
Subject: RE: how to "load" mmap directory into memory?

Li Li [fancyerii@gmail.com] 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Mime
View raw message