"Indin _bull?
Sent from my BlackBerry® wireless device

-----Original Message-----
From: Toke Eskildsen <t...@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 [fancye...@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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to