confused about how to set a solr query timeout when using tomcat

2014-11-27 Thread solr-user
I inherited a set of some old 1.4x Solrs running under tomcat6/java6

while I will eventually upgrade them to a more recent solr/tomcat/java, I am
unable to do in near term

one of my priority fixes tho is to implement some sort of timeout for solr
queries that exceed 1000ms (or so); ie if the query takes longer than that,
I want to abort that query (returning nothing or an error or whatever) so
that solr can process other queries.  while we have optimized our queries
for an average 50ms response time, we do occasionally see some that can run
between 10 and 100 seconds.

I know that this version of Solr itself doesn't have a built in timeout
mechanism, which leaves me with figuring out what to do (it seems to me that
I have to figure out how to get Tomcat to timeout the queries somehow)

note that I DID google until my fingers hurt and have not been able to find
clear (at least not clear to me) instructions on how do to so 

Details:

1. the setup uses the DataImportHandler to updates Solr, and updates occur
often and can be quite large; we use batchSize=1 and autoCommit=true
with doc size being around 1400 to 1600 bytes.  I dont want the timeout to
kill the imports of course

2. I tried adding a timeout param to the tomcat configuration but it doesnt
work:  Connector port=quot;8086quot; protocol=quot;HTTP/1.1quot;
connectionTimeout=quot;2quot; protocol=quot;HTTP/1.1quot;
timeout=quot;1quot; /

any thoughts??   can anyone point me in the right direction on how to
implement this?

any help appreciated.  thx in advance



--
View this message in context: 
http://lucene.472066.n3.nabble.com/confused-about-how-to-set-a-solr-query-timeout-when-using-tomcat-tp4171363.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: confused about how to set a solr query timeout when using tomcat

2014-11-27 Thread Walter Underwood
How big is the index (document count, gigabytes)?

How much RAM is on the servers?

How big is your Java heap?

How are the servers hosted? AWS?

Long queries are often caused by long-tail queries fetched from disk. There are 
several ways to speed these up, but they all use RAM or SSD.

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/


On Nov 27, 2014, at 12:56 PM, solr-user solr-u...@hotmail.com wrote:

 I inherited a set of some old 1.4x Solrs running under tomcat6/java6
 
 while I will eventually upgrade them to a more recent solr/tomcat/java, I am
 unable to do in near term
 
 one of my priority fixes tho is to implement some sort of timeout for solr
 queries that exceed 1000ms (or so); ie if the query takes longer than that,
 I want to abort that query (returning nothing or an error or whatever) so
 that solr can process other queries.  while we have optimized our queries
 for an average 50ms response time, we do occasionally see some that can run
 between 10 and 100 seconds.
 
 I know that this version of Solr itself doesn't have a built in timeout
 mechanism, which leaves me with figuring out what to do (it seems to me that
 I have to figure out how to get Tomcat to timeout the queries somehow)
 
 note that I DID google until my fingers hurt and have not been able to find
 clear (at least not clear to me) instructions on how do to so 
 
 Details:
 
 1. the setup uses the DataImportHandler to updates Solr, and updates occur
 often and can be quite large; we use batchSize=1 and autoCommit=true
 with doc size being around 1400 to 1600 bytes.  I dont want the timeout to
 kill the imports of course
 
 2. I tried adding a timeout param to the tomcat configuration but it doesnt
 work:  Connector port=quot;8086quot; protocol=quot;HTTP/1.1quot;
 connectionTimeout=quot;2quot; protocol=quot;HTTP/1.1quot;
 timeout=quot;1quot; /
 
 any thoughts??   can anyone point me in the right direction on how to
 implement this?
 
 any help appreciated.  thx in advance
 
 
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/confused-about-how-to-set-a-solr-query-timeout-when-using-tomcat-tp4171363.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: confused about how to set a solr query timeout when using tomcat

2014-11-27 Thread solr-user
millions of documents per shard, with a number of shards
~40gb index folder size
12gb of heap on a 16gb machine (this old Solr doesnt use O/S mem space like
4.x does)
servers are hosted internally, and are powerful

understood.  as mentioned, we tuned the bulk of our queries to run very
quickly (50ms or less), but we do occasionally see queries (ie internal ones
for statistics/tests) that can be excessively long running

Basically, we want to be able to enforce how long those long running queries
are allowed to run



--
View this message in context: 
http://lucene.472066.n3.nabble.com/confused-about-how-to-set-a-solr-query-timeout-when-using-tomcat-tp4171363p4171368.html
Sent from the Solr - User mailing list archive at Nabble.com.


RE: confused about how to set a solr query timeout when using tomcat

2014-11-27 Thread Toke Eskildsen
solr-user [solr-u...@hotmail.com] wrote:
 while we have optimized our queries for an average 50ms response time,
 we do occasionally see some that can run between 10 and 100 seconds.

That sounds suspicious. Response times so far from your average indicates that 
there is special processing going on, such as uninverting facet fields after an 
index update or garbage collection with a very large heap. In both of these 
cases, termination (if it were possible) would be undesirable as those jobs 
needs to be done.

 I know that this version of Solr itself doesn't have a built in timeout
 mechanism, which leaves me with figuring out what to do (it seems to me that
 I have to figure out how to get Tomcat to timeout the queries somehow)

You can get tomcat to timeout, but it only breaks the connection with the 
client: The request is still processed in Solr and will end with an error entry 
in the log as it cannot deliver the result back to the client. Even if you were 
able to somehow kill the started thread from the outside, which Java does not 
support, it might leave the Solr structures in a problematic state: The only 
technically sane way to do time-based termination of a request is to build it 
into the application, i.e. Solr.

- Toke Eskildsen


RE: confused about how to set a solr query timeout when using tomcat

2014-11-27 Thread solr-user
yes, that solr queries continue to run the query on the solr server even
after a connection is broken was my understanding and concern as well

I was hoping I had overlooked or missed something in Solr or Tomcat
documentation that might do the job

it is unfortunate

if anyone else can think of something, let me know




--
View this message in context: 
http://lucene.472066.n3.nabble.com/confused-about-how-to-set-a-solr-query-timeout-when-using-tomcat-tp4171363p4171379.html
Sent from the Solr - User mailing list archive at Nabble.com.