lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timo Nentwig <luc...@nitwit.de>
Subject Re: CachingWrapperFilter: why cache per IndexReader?
Date Tue, 01 Jan 2008 19:34:14 GMT
On Tuesday 01 January 2008 19:38:48 Shailendra Sharma wrote:
> > Is there are particular reason why CachingWrapperFilter caches per
> > IndexReader
> > and not per IndexReader.directory()? If there are multiple
> > IndexSearcher/IndexReader instances (and only one Directory) cache will
> > be built and held in memory redundantly. I don't see any sense in doing
> > so (?).
>
> It's very simple... when you are talking about cache here you are talking
> about "In Memory Cache" and not "Persistent" cache. IndexReader is
> something which closely resembles in-memory snapshot of indices, while
> directory() refers to persisted indices. With this analogy the caching
> solution fits best at IndexReader level.
>
> Over that, same directory can be opened by multiple processes (not threads)

Hmm? But it will be different instances anyway. And that's all you need to use 
it a key for a WeakHashMap. Maybe we are talking at cross-purposes...

I suggest to use reader.directory() instead of reader as key for the 
WeakHashMap. This way multiple IndexSearcher/IndexReacher instances would 
share the cache.

> - to complicate the situation these processes can be running on distributed
> machines. It would require lot of IPCs and very complicated solution to
> provide caching at directory level.
>
> Regards,
> Shailendra
>
> On Jan 1, 2008 11:56 PM, Grant Ingersoll <gsingers@apache.org> wrote:
> > My guess would be b/c best practice is usually to only have one Reader/
> > Searcher per Directory, but I don't know if that is the real reason.
> > Most discussions/testing I have seen indicate a single Reader/Searcher
> > performs best.
> >
> > -Grant
> >
> > On Jan 1, 2008, at 11:57 AM, Timo Nentwig wrote:
> > > Hi!
> > >
> > > Is there are particular reason why CachingWrapperFilter caches per
> > > IndexReader
> > > and not per IndexReader.directory()? If there are multiple
> > > IndexSearcher/IndexReader instances (and only one Directory) cache
> > > will be
> > > built and held in memory redundantly. I don't see any sense in doing
> > > so (?).
> > >
> > > Thanks for hints...
> > > Timo
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> > --------------------------
> > Grant Ingersoll
> > http://lucene.grantingersoll.com
> > http://www.lucenebootcamp.com
> >
> > Lucene Helpful Hints:
> > http://wiki.apache.org/lucene-java/BasicsOfPerformance
> > http://wiki.apache.org/lucene-java/LuceneFAQ
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org



---------------------------------------------------------------------
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