You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by brokensword <br...@te.net.ua> on 2010/09/15 21:41:17 UTC
[users@httpd] ApacheBench (ab) Keep-Alive feature behavior
Hi.
I'm testing performance of some hand-made (on sockets) web-server.
Everything looks fine, except "keep-alive http" test case. As I understand -
in "keep-alive http" mode I shouldn't close() socket after each operation.
So cycle should look like following:
accept()
read()
write()
read()
write()
...
until I receive "Connection: close" or some error etc.
After launching ab with -k flag, ab always hangs after first write(). I see
my server's "Hello world" output in ab logs, but ab hangs forever until
timeout fires and I never receive anything from second read().
If I change logic to
accept()
read()
write()
close()
accept()
read()
write()
close()
...
everything works fine with ab -k.
But I'm losing sense of this keep-alive HTTP protocol feature then :(
Who can explain?
If you need a code - you can find it there:
http://zenebo.com/lighttz.c.tar.gz
just comment there closing of socket in write callback (close(cli->fd)) and
ev_io_stop(EV_A_ w) in read and write callbacks. Also change Connection:
close in http response to Connection: Keep-Alive.
--
View this message in context: http://old.nabble.com/ApacheBench-%28ab%29-Keep-Alive-feature-behavior-tp29721213p29721213.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: ApacheBench (ab) Keep-Alive feature behavior
Posted by brokensword <br...@te.net.ua>.
Will answer myself: simply was inaccurate in response with Content-Length
field - forgot to count last \r\n in content body.
brokensword wrote:
>
> Hi.
>
> I'm testing performance of some hand-made (on sockets) web-server.
> Everything looks fine, except "keep-alive http" test case. As I understand
> - in "keep-alive http" mode I shouldn't close() socket after each
> operation.
> So cycle should look like following:
> accept()
> read()
> write()
> read()
> write()
> ...
> until I receive "Connection: close" or some error etc.
>
> After launching ab with -k flag, ab always hangs after first write(). I
> see my server's "Hello world" output in ab logs, but ab hangs forever
> until timeout fires and I never receive anything from second read().
>
> If I change logic to
> accept()
> read()
> write()
> close()
> accept()
> read()
> write()
> close()
> ...
> everything works fine with ab -k.
>
> But I'm losing sense of this keep-alive HTTP protocol feature then :(
>
> Who can explain?
>
> If you need a code - you can find it there:
> http://zenebo.com/lighttz.c.tar.gz
>
> just comment there closing of socket in write callback (close(cli->fd))
> and ev_io_stop(EV_A_ w) in read and write callbacks. Also change
> Connection: close in http response to Connection: Keep-Alive.
>
>
--
View this message in context: http://old.nabble.com/ApacheBench-%28ab%29-Keep-Alive-feature-behavior-tp29721213p29722914.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org