lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Ritchie <>
Subject Re: Caching filter wrapper (was Re: RE : DateFilter.Before/After)
Date Mon, 15 Sep 2003 21:18:12 GMT
Doug Cutting wrote:
> If you do get a chance to look into this, I'd love to hear more.
> FieldsReader.doc() could easily be re-written to be re-entrant.  For a 
> start, it could synchronize separately on fieldStream and indexStream, 
> which would let two threads use it at once.  (If an index is not 
> optimized, the situtation would be even better, since there would be a 
> fieldStream and indexStream per index segment.)
> If that's not enough, then it could be re-written to use either a pool 
> of cloned input streams, or just to clone a new stream for each call. 
> (The primary expense of cloning a stream is allocating a 1k buffer.)

I think that using a pool of cloned inputStreams would be the best solution. I've implemented
such a 
solution locally using two pools of 3 readers each (configurable via system properties) and
post the diff after I do some testing to confirm accuracy and speed improvements.

I'm a little unsure of how exactly to best write JUnit test(s) for these changes as any tests
take into account multiple threads and simultaneous reads (to test that the object pool I
actually works as advertised). Any ideas would be appreciated.


Bruce Ritchie

View raw message