lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Shaw <>
Subject Re: First search is slow after updating index .. subsequent searches very fast
Date Thu, 21 Dec 2006 18:34:38 GMT

On Thu, 2006-12-21 at 10:21 -0800, Otis Gospodnetic wrote:
> Something like dd if=/path/to/index/foo.cfs of=/dev/null
> Basically, force the data through the kernel preemptively, so FS caches it.
> Run vmstat while doing it, and if the index hasn't been cached by the FS,
> you should see a spike in IO activity while dd is running.

You might be able to do this more efficiently with the posix_fadvise()
function.  C pseudocode:

        int fd = open ("/path/to/index/foo.cfs");
        // indicate you'll be reading the file sequentially
        posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
        // tell the kernel you will need the whole file.
        posix_fadvice (fd, 0, 0, POSIX_FADV_WILLNEED);

I don't know offhand if Java binds these APIs, though.


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

View raw message