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 Brent Ryan <br...@gmail.com> on 2013/09/10 22:37:42 UTC
apache bench solr keep alive not working?
Does anyone know why solr is not respecting keep-alive requests when using
apache bench?
ab -v 4 -H "Connection: Keep-Alive" -H "Keep-Alive: 3000" -k -c 10 -n 100 "
http://host1:8983/solr/test.solr/select?q=*%3A*&wt=xml&indent=true"
Response contains this and if you look at debug output you see http header
of Connection: Close
Keep-Alive requests: 0
Any ideas? I'm seeing the same behavior when using http client.
Thanks,
Brent
Re: apache bench solr keep alive not working?
Posted by Shawn Heisey <so...@elyograg.org>.
On 9/10/2013 2:37 PM, Brent Ryan wrote:
> Does anyone know why solr is not respecting keep-alive requests when using
> apache bench?
>
> ab -v 4 -H "Connection: Keep-Alive" -H "Keep-Alive: 3000" -k -c 10 -n 100 "
> http://host1:8983/solr/test.solr/select?q=*%3A*&wt=xml&indent=true"
>
>
> Response contains this and if you look at debug output you see http header
> of Connection: Close
>
> Keep-Alive requests: 0
>
>
> Any ideas? I'm seeing the same behavior when using http client.
This would be controlled by the webserver settings in whatever container
you are using to run Solr. If you have no idea what I'm talking about,
you're probably using the Jetty that comes in the Solr example
(start.jar). If you're using another container like Tomcat, then I
don't know how to help you at all.
I don't know whether Solr will work correctly on a connection with
keepalive. If the container can keep the requests separate, it probably
will.
Getting help with the container (even the included Jetty) is outside the
scope of this mailing list, but I did a little bit of research.
HTTP 1.0 has no official keepalive mechanism. Some implementations do
support it, but it's not part of the official specification.
I read something which said that Jetty will automatically handle
keepalive if you send it HTTP 1.1 connections. Apache Bench only does
HTTP 1.0, though.
Thanks,
Shawn
Re: apache bench solr keep alive not working?
Posted by Chris Hostetter <ho...@fucit.org>.
: Chunked is HTTP/1.1 only, so that could be the problem. --wunder
well ... yes and no.
the *request* ab sends are specified as http/1.0, and in that request
it uses the (non-RFC complieant but generally accepted) http/1.0 style
keep-alive headers.
jetty parses the http/1.0 request fine, but is sending an http/1.1
response back that uses the chunked responses (i can't remembe if
that's kosher according to the spec, but it's what seems to be happening)
ab is then (evidently) happily parsing that http/1.1 response, chunking
and all, but some where alone the way, something is not prserving the goal
of using Keep-Alive.
bottom line: it's a mess and this is why no one should be using http/1.0.
you sure as hell shouldn't be trying to test the perforance of an app
using http/1.0 connections, unless you actually expect to be using
http/1.0 in your production code -- and if you are, then good luck to you,
but i've got no help to offer you.
-Hoss
Re: apache bench solr keep alive not working?
Posted by Walter Underwood <wu...@wunderwood.org>.
Chunked is HTTP/1.1 only, so that could be the problem. --wunder
On Sep 10, 2013, at 5:41 PM, Chris Hostetter wrote:
>
> : I've also used apache bench for a bunch of stuff and keep-alive works fine
> : with things like Java netty.io servers ... strange that tomcat isn't
> : respecting the http protocol or headers....
>
> as i said, it's probably *very* specific to the combination of trying to
> use a chunked response (because the Content-Length is not known in
> advance) use with http/1.0 + keep-alive (the 1.0 + keep-alive combination
> itself is not actually part of the official http 1.0 spec -- it's a hack
> that mostly works)
>
> If you fetch a resource that has a fixed Content-Length, so chunked
> encoding isn't used, then ab may likely show you that the http/1.0 +
> keep-alive hack works just fine on your server...
>
> $ ab -v 4 -k -c 10 -n 1000 http://localhost:8983/solr/img/solr.png 2>&1 | grep "Keep-Alive requests"
> Keep-Alive requests: 1000
>
>
>
> -Hoss
Re: apache bench solr keep alive not working?
Posted by Chris Hostetter <ho...@fucit.org>.
: I've also used apache bench for a bunch of stuff and keep-alive works fine
: with things like Java netty.io servers ... strange that tomcat isn't
: respecting the http protocol or headers....
as i said, it's probably *very* specific to the combination of trying to
use a chunked response (because the Content-Length is not known in
advance) use with http/1.0 + keep-alive (the 1.0 + keep-alive combination
itself is not actually part of the official http 1.0 spec -- it's a hack
that mostly works)
If you fetch a resource that has a fixed Content-Length, so chunked
encoding isn't used, then ab may likely show you that the http/1.0 +
keep-alive hack works just fine on your server...
$ ab -v 4 -k -c 10 -n 1000 http://localhost:8983/solr/img/solr.png 2>&1 | grep "Keep-Alive requests"
Keep-Alive requests: 1000
-Hoss
Re: apache bench solr keep alive not working?
Posted by Brent Ryan <br...@gmail.com>.
thanks guys. I saw this other post with curl and verified it working.
I've also used apache bench for a bunch of stuff and keep-alive works fine
with things like Java netty.io servers ... strange that tomcat isn't
respecting the http protocol or headers....
There must be a bug in this version of tomcat being used.
On Tue, Sep 10, 2013 at 6:23 PM, Chris Hostetter
<ho...@fucit.org>wrote:
>
> : Does anyone know why solr is not respecting keep-alive requests when
> using
> : apache bench?
>
> I've seen this before from people trying to test with "ab", but never
> fully understood it.
>
> There is some combination of using ab (which uses HTTP/1.0 and the non-RFC
> compliant HTTP/1.0 version of optional Keep-Alive) and jetty (which also
> attempts to support the non-RFC compliant HTTP/1.0 version of optional
> Keep-Alive) and chunked responses that come from jetty when you request
> dynamic resources (like solr query URLs) as opposed to static resources
> with a known file size.
>
> I suspect that jetty's best attempt at doing the hooky HTTP/1.0 Keep-Alive
> thing doesn't work with chunked responses -- or maybe ab doesn't actually
> keep the connection alive unless it gets a content-length.
>
> either way, see this previous thread for how you can demonstrate that
> keep-alive works properly using curl...
>
>
> https://mail-archives.apache.org/mod_mbox/lucene-solr-user/201209.mbox/%3C5048E856.9080905@ea.com%3E
>
>
> -Hoss
>
Re: apache bench solr keep alive not working?
Posted by Chris Hostetter <ho...@fucit.org>.
: Does anyone know why solr is not respecting keep-alive requests when using
: apache bench?
I've seen this before from people trying to test with "ab", but never
fully understood it.
There is some combination of using ab (which uses HTTP/1.0 and the non-RFC
compliant HTTP/1.0 version of optional Keep-Alive) and jetty (which also
attempts to support the non-RFC compliant HTTP/1.0 version of optional
Keep-Alive) and chunked responses that come from jetty when you request
dynamic resources (like solr query URLs) as opposed to static resources
with a known file size.
I suspect that jetty's best attempt at doing the hooky HTTP/1.0 Keep-Alive
thing doesn't work with chunked responses -- or maybe ab doesn't actually
keep the connection alive unless it gets a content-length.
either way, see this previous thread for how you can demonstrate that
keep-alive works properly using curl...
https://mail-archives.apache.org/mod_mbox/lucene-solr-user/201209.mbox/%3C5048E856.9080905@ea.com%3E
-Hoss