lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Query in Lucene 2.3.0
Date Fri, 01 Feb 2008 07:54:33 GMT

The write.lock has always been to prevent multiple instances of  
IndexWriter (or, IndexReader doing deletes) from operating on the  
same index at a time.

Many threads sharing a single instance of these classes has always  
been fine.

Mike

ajay_garg wrote:

>
> @Mike.
>
> Thanks for the reply. But I had thought that write.lock is there to  
> prevent
> multiple additions/updates/deleteDocuments.
>
> Has there been a change recently in this regard ?
>
> Thanks
> Ajay Garg
>
>
>
> Michael McCandless-2 wrote:
>>
>>
>> That's right.
>>
>> Each thread can enter IndexWriter.add/update/deleteDocument(s) in
>> parallel.  There are some parts inside IndexWriter that are
>> synchronized but they are kept to a minimum to keep good thread
>> concurrency.  As you add threads it's best to increase the RAM buffer
>> at the same time to get better performance.
>>
>> Mike
>>
>> ajay_garg wrote:
>>
>>>
>>> @Yonik
>>>
>>> So you mean to say, that if two threads have the same instance of an
>>> IndexWriter passed to both of them, and both these threads run on  
>>> two
>>> different CPUs, then they can write to the index at the same time ?
>>>
>>>
>>>
>>> Yonik Seeley wrote:
>>>>
>>>> On Jan 30, 2008 10:59 PM, ajay_garg
>>>> <garg.jeena.isi.ka.naam.hai@gmail.com> wrote:
>>>>>
>>>>> Thanks Mike for your directions.
>>>>>
>>>>> Yes, I am in fact using a single computer for my application, and
>>>>> your
>>>>> saying that in this case, multiple threads with a single
>>>>> IndexWriter wll
>>>>> give a better performance. Hmmm. I just wonder that since each
>>>>> IndexWriter
>>>>> has a single write.lock, this means that sitting on the CPU, we
>>>>> observe
>>>>> that
>>>>> at a particular instant, only a single thread is using the CPU,
>>>>
>>>> The write.lock is to protect against other IndexWriter instances,
>>>> *not* against other threads.
>>>> Using multiple threads on a single IndexWriter should utilize
>>>> multiple
>>>> CPUs.
>>>>
>>>> -Yonik
>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context: http://www.nabble.com/Query-in-
>>> Lucene-2.3.0-tp15175141p15198783.html
>>> Sent from the Lucene - Java Users mailing list archive at  
>>> Nabble.com.
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> 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
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Query-in- 
> Lucene-2.3.0-tp15175141p15221338.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------


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