You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Jason Rutherglen <ja...@gmail.com> on 2009/05/28 21:06:28 UTC

NRT getReader turnaround on large segments

An interesting discussion came up.  How do we handle IW.getReader turnaround
time on large new segments?

Re: NRT getReader turnaround on large segments

Posted by Michael McCandless <lu...@mikemccandless.com>.
Newly added docs are still free to make new segments, and be reopened,
while this warming is taking place.

So, getReader() will wait for newly added/deleted docs to be flushed &
reopened, but will not wait for any running merges to complete (finish
writing the files & finish warming a SegmentReader on the resulting
merged segment).

Mike

On Thu, May 28, 2009 at 3:57 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> On Thu, May 28, 2009 at 3:30 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
>> This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
>> merged segment before committing to SegmentInfos.
>>
>> So, while such warming is happening, if getReader() is called, the
>> returned reader will still read the old segments.
>
> I don't see how this helps turnaround time from document addition to
> making it searchable.
>
> Using the old reader until the new one is "ready" (however that's
> defined) can easily be done at the application level (like Solr and
> others do it).  It seems like getReader() should block until it can
> return a reader containing all of the documents previously added...
> that gives the most power to the application.
>
> -Yonik
> http://www.lucidimagination.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: NRT getReader turnaround on large segments

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Thu, May 28, 2009 at 4:59 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> On Thu, May 28, 2009 at 4:18 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
>> Newly added docs are still free to make new segments, and be reopened,
>> while this warming is taking place.
>>
>> So, getReader() will wait for newly added/deleted docs to be flushed &
>> reopened, but will not wait for any running merges to complete (finish
>> writing the files & finish warming a SegmentReader on the resulting
>> merged segment).
>
> Oh, ok... perfect!  (but tricky ;-)

Yes, tricky!  But, nice that it can be done in a BG thread (as long as
you are using CMS).

However, the NRT turnaround time is still gated by the time to clone a
deleted docs BitVector, which is in proportion to the # docs in that
segment, if you are using deletions.  Likewise if you are setting
norms.  So for a large index this will become a sizable cost... we
need to somehow make a switch to transactional data structures that
incrementally copy-on-write eg one dirty block at a time.  There's an
issue open for this.

And we are iterating on LUCENE-1313 to hold recently flushed segments
in a RAMDir.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: NRT getReader turnaround on large segments

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Thu, May 28, 2009 at 4:18 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
> Newly added docs are still free to make new segments, and be reopened,
> while this warming is taking place.
>
> So, getReader() will wait for newly added/deleted docs to be flushed &
> reopened, but will not wait for any running merges to complete (finish
> writing the files & finish warming a SegmentReader on the resulting
> merged segment).

Oh, ok... perfect!  (but tricky ;-)

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: NRT getReader turnaround on large segments

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Thu, May 28, 2009 at 3:30 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
> This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
> merged segment before committing to SegmentInfos.
>
> So, while such warming is happening, if getReader() is called, the
> returned reader will still read the old segments.

I don't see how this helps turnaround time from document addition to
making it searchable.

Using the old reader until the new one is "ready" (however that's
defined) can easily be done at the application level (like Solr and
others do it).  It seems like getReader() should block until it can
return a reader containing all of the documents previously added...
that gives the most power to the application.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: NRT getReader turnaround on large segments

Posted by Jason Rutherglen <ja...@gmail.com>.
Also important to note that only with ConcurrentMergeScheduler will the
segmentReader warming occur in the background.  When using
SerialMergeScheduler, the warming will happen in the foreground.

On Thu, May 28, 2009 at 12:40 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Right.  If you play w/ this please report back on how it goes!
>
> Mike
>
> On Thu, May 28, 2009 at 3:38 PM, Jason Rutherglen
> <ja...@gmail.com> wrote:
> > And warming a segment in mergeMiddle doesn't block the addition of new
> > segments.
> >
> > On Thu, May 28, 2009 at 12:30 PM, Michael McCandless
> > <lu...@mikemccandless.com> wrote:
> >>
> >> This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
> >> merged segment before committing to SegmentInfos.
> >>
> >> So, while such warming is happening, if getReader() is called, the
> >> returned reader will still read the old segments.
> >>
> >> Mike
> >>
> >> On Thu, May 28, 2009 at 3:06 PM, Jason Rutherglen
> >> <ja...@gmail.com> wrote:
> >> > An interesting discussion came up.  How do we handle IW.getReader
> >> > turnaround
> >> > time on large new segments?
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-dev-help@lucene.apache.org
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: NRT getReader turnaround on large segments

Posted by Michael McCandless <lu...@mikemccandless.com>.
Right.  If you play w/ this please report back on how it goes!

Mike

On Thu, May 28, 2009 at 3:38 PM, Jason Rutherglen
<ja...@gmail.com> wrote:
> And warming a segment in mergeMiddle doesn't block the addition of new
> segments.
>
> On Thu, May 28, 2009 at 12:30 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
>>
>> This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
>> merged segment before committing to SegmentInfos.
>>
>> So, while such warming is happening, if getReader() is called, the
>> returned reader will still read the old segments.
>>
>> Mike
>>
>> On Thu, May 28, 2009 at 3:06 PM, Jason Rutherglen
>> <ja...@gmail.com> wrote:
>> > An interesting discussion came up.  How do we handle IW.getReader
>> > turnaround
>> > time on large new segments?
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: NRT getReader turnaround on large segments

Posted by Jason Rutherglen <ja...@gmail.com>.
And warming a segment in mergeMiddle doesn't block the addition of new
segments.

On Thu, May 28, 2009 at 12:30 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
> merged segment before committing to SegmentInfos.
>
> So, while such warming is happening, if getReader() is called, the
> returned reader will still read the old segments.
>
> Mike
>
> On Thu, May 28, 2009 at 3:06 PM, Jason Rutherglen
> <ja...@gmail.com> wrote:
> > An interesting discussion came up.  How do we handle IW.getReader
> turnaround
> > time on large new segments?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: NRT getReader turnaround on large segments

Posted by Michael McCandless <lu...@mikemccandless.com>.
This is exactly why we added IndexReaderWarmer -- it pre-warms a newly
merged segment before committing to SegmentInfos.

So, while such warming is happening, if getReader() is called, the
returned reader will still read the old segments.

Mike

On Thu, May 28, 2009 at 3:06 PM, Jason Rutherglen
<ja...@gmail.com> wrote:
> An interesting discussion came up.  How do we handle IW.getReader turnaround
> time on large new segments?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org