On 4/9/15 9:13 AM, Bruno Albuquerque wrote:
> I have this index with around 4.5 million documents. When i do some queries
> on it, it takes a couple of hundred ms to complete... but only the first
> time I do them. If I repeat the same search another time, it answers the
> queries an order of magnitude faster. More interestingly, it continues
> being faster even after I restart my client code, which leads me to believe
> that some optimization happens when I do a query and is persisted into the
> index.
> 
> What is the mechanism that is making that happen? Is that just a cache
> being written to the index itself or is it something fancier? if it is
> something fancier, is there a way to "warm up" the index in a way that most
> queries would be faster from the get go (even at the cost of space)?
> 
> Thanks in advance.
> 

You're experiencing the Lucy "the OS is our JVM"[0] philosophy of mmap[1].

I don't think there's a way to pre-warm it, other than creating and exercising 
a Searcher.

[0]
http://lucene.472066.n3.nabble.com/Lucy-Wiki-Update-of-quot-LucyIncubatorProposal-quot-by-MarvinHumphrey-td934939.html
[1] http://en.wikipedia.org/wiki/Mmap


-- 
Peter Karman  .  www.peknet.com  .  @peterkarman

Reply via email to