You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by thiruvee <th...@gmail.com> on 2009/03/23 17:53:06 UTC

First request for search is taking longer time and subequent requests are very fast

Hi 

I am using Lucene 2.4 in our project.
I am using FSdirectory to store the index.
when ever index is updated the first search is very slow.
I am using the combination of CustomScoreQuery and DisjunctionMaxQuery for
searching.
This slowness I observed even when the server (tomcat/websphere) is idle for
quite a long time.

I tried to using RAMDirectory instead of FSDirectory, the response time was
improved, but still the difference the between first search and subsequent
search is there.

Any help regarding this would be highly appreciated.

Thanks
Ravi
-- 
View this message in context: http://www.nabble.com/First-request-for-search-is-taking-longer-time-and-subequent-requests-are-very-fast-tp22663883p22663883.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


Re: First request for search is taking longer time and subequent requests are very fast

Posted by thiruvee <th...@gmail.com>.
Hi
I have 3 instances running for this.
1. Windows + tomcat
2. Linux + tomcat
3. Linx + WebSphere

I observed this problem on all the 3 instances.

Thanks
Ravi

Michael McCandless-2 wrote:
> 
> 
> Which OS are you on?
> 
> It's possible the OS has decided to swap Tomcat's pages out to use RAM  
> as IO cache for other processes, instead.
> 
> Mike
> 
> thiruvee wrote:
> 
>>
>> Hi David,
>>
>> Thanks for your reply.
>> 1. I will try having warm up queries after index is created, that  
>> will solve
>> to some extent.
>> 2. The biggest problem is server would be idle for long time.
>>
>> I am using spring in my project and the searcher,reader are singleton
>> objects managed by spring.
>>
>> I don't use any servlet, but i use AXIS to expose as webservice.
>>
>> Please suggest me any other thoughts...
>>
>> Thanks
>> Ravi
>>
>>
>> David Causse-2 wrote:
>>>
>>> Hi,
>>>
>>> Searcher and IndexReader use an internal cache, when your searcher is
>>> created the first query is slow cause lucene fills its cache.
>>> We re-use whenever possible searchers and readers instances.
>>> I've heard on this list that it's also a solution to launch warmup
>>> queries just after reader/searcher instanciation and not wait for  
>>> an end
>>> user query.
>>> When your server is idle for long maybe your servlet instance are
>>> serialized to disk and you store your searcher insible a member  
>>> variable
>>> of it? I guess you have to find another way to store your searcher, a
>>> singleton or something like that.
>>>
>>> David.
>>>
>>> thiruvee a écrit :
>>>> Hi
>>>>
>>>> I am using Lucene 2.4 in our project.
>>>> I am using FSdirectory to store the index.
>>>> when ever index is updated the first search is very slow.
>>>> I am using the combination of CustomScoreQuery and  
>>>> DisjunctionMaxQuery
>>>> for
>>>> searching.
>>>> This slowness I observed even when the server (tomcat/websphere)  
>>>> is idle
>>>> for
>>>> quite a long time.
>>>>
>>>> I tried to using RAMDirectory instead of FSDirectory, the response  
>>>> time
>>>> was
>>>> improved, but still the difference the between first search and
>>>> subsequent
>>>> search is there.
>>>>
>>>> Any help regarding this would be highly appreciated.
>>>>
>>>> Thanks
>>>> Ravi
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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/First-request-for-search-is-taking-longer-time-and-subequent-requests-are-very-fast-tp22663883p22665327.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/First-request-for-search-is-taking-longer-time-and-subequent-requests-are-very-fast-tp22663883p22666056.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


Re: First request for search is taking longer time and subequent requests are very fast

Posted by Michael McCandless <lu...@mikemccandless.com>.
Which OS are you on?

It's possible the OS has decided to swap Tomcat's pages out to use RAM  
as IO cache for other processes, instead.

Mike

thiruvee wrote:

>
> Hi David,
>
> Thanks for your reply.
> 1. I will try having warm up queries after index is created, that  
> will solve
> to some extent.
> 2. The biggest problem is server would be idle for long time.
>
> I am using spring in my project and the searcher,reader are singleton
> objects managed by spring.
>
> I don't use any servlet, but i use AXIS to expose as webservice.
>
> Please suggest me any other thoughts...
>
> Thanks
> Ravi
>
>
> David Causse-2 wrote:
>>
>> Hi,
>>
>> Searcher and IndexReader use an internal cache, when your searcher is
>> created the first query is slow cause lucene fills its cache.
>> We re-use whenever possible searchers and readers instances.
>> I've heard on this list that it's also a solution to launch warmup
>> queries just after reader/searcher instanciation and not wait for  
>> an end
>> user query.
>> When your server is idle for long maybe your servlet instance are
>> serialized to disk and you store your searcher insible a member  
>> variable
>> of it? I guess you have to find another way to store your searcher, a
>> singleton or something like that.
>>
>> David.
>>
>> thiruvee a écrit :
>>> Hi
>>>
>>> I am using Lucene 2.4 in our project.
>>> I am using FSdirectory to store the index.
>>> when ever index is updated the first search is very slow.
>>> I am using the combination of CustomScoreQuery and  
>>> DisjunctionMaxQuery
>>> for
>>> searching.
>>> This slowness I observed even when the server (tomcat/websphere)  
>>> is idle
>>> for
>>> quite a long time.
>>>
>>> I tried to using RAMDirectory instead of FSDirectory, the response  
>>> time
>>> was
>>> improved, but still the difference the between first search and
>>> subsequent
>>> search is there.
>>>
>>> Any help regarding this would be highly appreciated.
>>>
>>> Thanks
>>> Ravi
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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/First-request-for-search-is-taking-longer-time-and-subequent-requests-are-very-fast-tp22663883p22665327.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


Re: First request for search is taking longer time and subequent requests are very fast

Posted by thiruvee <th...@gmail.com>.
Hi David,

Thanks for your reply. 
1. I will try having warm up queries after index is created, that will solve
to some extent.
2. The biggest problem is server would be idle for long time.

I am using spring in my project and the searcher,reader are singleton
objects managed by spring.

I don't use any servlet, but i use AXIS to expose as webservice.

Please suggest me any other thoughts...

Thanks
Ravi


David Causse-2 wrote:
> 
> Hi,
> 
> Searcher and IndexReader use an internal cache, when your searcher is 
> created the first query is slow cause lucene fills its cache.
> We re-use whenever possible searchers and readers instances.
> I've heard on this list that it's also a solution to launch warmup 
> queries just after reader/searcher instanciation and not wait for an end 
> user query.
> When your server is idle for long maybe your servlet instance are 
> serialized to disk and you store your searcher insible a member variable 
> of it? I guess you have to find another way to store your searcher, a 
> singleton or something like that.
> 
> David.
> 
> thiruvee a écrit :
>> Hi 
>>
>> I am using Lucene 2.4 in our project.
>> I am using FSdirectory to store the index.
>> when ever index is updated the first search is very slow.
>> I am using the combination of CustomScoreQuery and DisjunctionMaxQuery
>> for
>> searching.
>> This slowness I observed even when the server (tomcat/websphere) is idle
>> for
>> quite a long time.
>>
>> I tried to using RAMDirectory instead of FSDirectory, the response time
>> was
>> improved, but still the difference the between first search and
>> subsequent
>> search is there.
>>
>> Any help regarding this would be highly appreciated.
>>
>> Thanks
>> Ravi
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/First-request-for-search-is-taking-longer-time-and-subequent-requests-are-very-fast-tp22663883p22665327.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


Re: First request for search is taking longer time and subequent requests are very fast

Posted by David Causse <dc...@spotter.com>.
Hi,

Searcher and IndexReader use an internal cache, when your searcher is 
created the first query is slow cause lucene fills its cache.
We re-use whenever possible searchers and readers instances.
I've heard on this list that it's also a solution to launch warmup 
queries just after reader/searcher instanciation and not wait for an end 
user query.
When your server is idle for long maybe your servlet instance are 
serialized to disk and you store your searcher insible a member variable 
of it? I guess you have to find another way to store your searcher, a 
singleton or something like that.

David.

thiruvee a écrit :
> Hi 
>
> I am using Lucene 2.4 in our project.
> I am using FSdirectory to store the index.
> when ever index is updated the first search is very slow.
> I am using the combination of CustomScoreQuery and DisjunctionMaxQuery for
> searching.
> This slowness I observed even when the server (tomcat/websphere) is idle for
> quite a long time.
>
> I tried to using RAMDirectory instead of FSDirectory, the response time was
> improved, but still the difference the between first search and subsequent
> search is there.
>
> Any help regarding this would be highly appreciated.
>
> Thanks
> Ravi
>   


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