You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sergio Stateri <st...@gmail.com> on 2013/09/16 15:15:37 UTC

Slow query at first time

Hi,

I´m trying to make a search with Solr 4.4, but in the first time the search
is too slow. I have studied about pre-warm queries, but the query response
is the same after putting it. Can anyone help me? Here´s a piece of
solrconfig.xml:

 <listener event="firstSearcher" class="solr.QuerySenderListener">
  <arr name="queries">
<lst>
  <str name="q">codigoRoteiro:95240816</str>
  <str name="start">0</str>
  <str name="rows">20</str>
</lst>
  </arr>
</listener>

in the schema.xml:

<field name="codigoRoteiro" type="integer" indexed="true" stored="true"
required="true" multiValued="false" />
</fields>

 <uniqueKey>codigoRoteiro</uniqueKey>

When I start Solr, the following message is shown:

$ java -server -Xms2048m -Xmx4096m -Dsolr.solr.home="./oracleCore/solr"
-jar start.jar
.
.
.
8233 [searcherExecutor-4-thread-1] INFO  org.apache.solr.core.SolrCore  û
QuerySenderListener done.
8235 [searcherExecutor-4-thread-1] INFO  org.apache.solr.core.SolrCore  û
[db] Registered new searcher
Searcher@30b6b67dmain{StandardDirectoryReader(segments_6:34
_f(4.4):C420060)}

And here´s my solrj sample code:

SolrServer solrServer = new HttpSolrServer(solrServerUrl);

SolrQuery query = new SolrQuery();
query.setQuery("codigoRoteiro:95240816");

query.set("start", "0"); query.set("rows", "20");
query.addField("codigoRoteiro"); query.addField("rowidString");
query.addField("descricaoRoteiro"); query.addField("numeroDias");
query.addField("numeroNoites"); query.addField("dataSaida");

Date initialTime = new Date(); QueryResponse rsp = server.query( query );
SolrDocumentList docs = rsp.getResults(); Date finalTime = new Date();
System.out.println("Total timel: " +
(finalTime.getTime()-initialTime.getTime()) + " ms");


The response time is arround 200 ms. If I remove the prewarm query, the
response time doesn´t change. Shouldn´t the response time be minor when
using pre-warm query?


Thanks in advance,

-- 
Sergio Stateri Jr.
stateri@gmail.com

Re: Slow query at first time

Posted by Shawn Heisey <so...@elyograg.org>.
On 9/16/2013 7:15 AM, Sergio Stateri wrote:
> I´m trying to make a search with Solr 4.4, but in the first time the search
> is too slow. I have studied about pre-warm queries, but the query response
> is the same after putting it. Can anyone help me? Here´s a piece of
> solrconfig.xml:
> 
>  <listener event="firstSearcher" class="solr.QuerySenderListener">

You've configured a firstSearcher.  Basically what this means is that
this query will be run when Solr first starts up, and never run again
after that.  Make it a newSearcher instead of firstSearcher, and it will
get run every time a new searcher gets created, and it might solve your
problem.

For further troublsehooting if the change above doesn't help, how big is
your index, and how much RAM does the machine have?  We already know
what your java heap is (2GB minimum, 4GB maximum).

Thanks,
Shawn


Re: Slow query at first time

Posted by Furkan KAMACI <fu...@gmail.com>.
What is query time of your search?

I mean as like that:

QueryResponse solrResponse = query(solrParams);
solrResponse.getQTime();


2013/9/16 Sergio Stateri <st...@gmail.com>

> Hi,
>
> I´m trying to make a search with Solr 4.4, but in the first time the search
> is too slow. I have studied about pre-warm queries, but the query response
> is the same after putting it. Can anyone help me? Here´s a piece of
> solrconfig.xml:
>
>  <listener event="firstSearcher" class="solr.QuerySenderListener">
>   <arr name="queries">
> <lst>
>   <str name="q">codigoRoteiro:95240816</str>
>   <str name="start">0</str>
>   <str name="rows">20</str>
> </lst>
>   </arr>
> </listener>
>
> in the schema.xml:
>
> <field name="codigoRoteiro" type="integer" indexed="true" stored="true"
> required="true" multiValued="false" />
> </fields>
>
>  <uniqueKey>codigoRoteiro</uniqueKey>
>
> When I start Solr, the following message is shown:
>
> $ java -server -Xms2048m -Xmx4096m -Dsolr.solr.home="./oracleCore/solr"
> -jar start.jar
> .
> .
> .
> 8233 [searcherExecutor-4-thread-1] INFO  org.apache.solr.core.SolrCore  û
> QuerySenderListener done.
> 8235 [searcherExecutor-4-thread-1] INFO  org.apache.solr.core.SolrCore  û
> [db] Registered new searcher
> Searcher@30b6b67dmain{StandardDirectoryReader(segments_6:34
> _f(4.4):C420060)}
>
> And here´s my solrj sample code:
>
> SolrServer solrServer = new HttpSolrServer(solrServerUrl);
>
> SolrQuery query = new SolrQuery();
> query.setQuery("codigoRoteiro:95240816");
>
> query.set("start", "0"); query.set("rows", "20");
> query.addField("codigoRoteiro"); query.addField("rowidString");
> query.addField("descricaoRoteiro"); query.addField("numeroDias");
> query.addField("numeroNoites"); query.addField("dataSaida");
>
> Date initialTime = new Date(); QueryResponse rsp = server.query( query );
> SolrDocumentList docs = rsp.getResults(); Date finalTime = new Date();
> System.out.println("Total timel: " +
> (finalTime.getTime()-initialTime.getTime()) + " ms");
>
>
> The response time is arround 200 ms. If I remove the prewarm query, the
> response time doesn´t change. Shouldn´t the response time be minor when
> using pre-warm query?
>
>
> Thanks in advance,
>
> --
> Sergio Stateri Jr.
> stateri@gmail.com
>