Dag-Erling Smørgrav <[EMAIL PROTECTED]> writes: > "Monty Ree" <[EMAIL PROTECTED]> writes: > > Why this result happens? varnish doesn't support keepalive? > I see the same symptom; tcpdump shows that ab does not send a new > request after receiving each answer, but waits for the session to time > out and then reconnects. I'm not sure if it's a bug in ab or in > Varnish.
Varnish always responds with HTTP 1.1 (even though ab sends HTTP 1.0 requests) and does not send "Connection: keep-alive" (since that is the default in HTTP 1.1). With the attached patch, I get the following results on my laptop: Concurrency Level: 200 Time taken for tests: 46.386721 seconds Complete requests: 100000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 100000 Total transferred: 23420240072 bytes HTML transferred: 23396793740 bytes Requests per second: 2155.79 [#/sec] (mean) Time per request: 92.773 [ms] (mean) Time per request: 0.464 [ms] (mean, across all concurrent requests) Transfer rate: 493057.66 [Kbytes/sec] received DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no
Index: bin/varnishd/cache_response.c =================================================================== --- bin/varnishd/cache_response.c (revision 1742) +++ bin/varnishd/cache_response.c (working copy) @@ -76,8 +76,8 @@ http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid); TIM_format(sp->obj->last_modified, lm); http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Last-Modified: %s", lm); - if (sp->doclose != NULL) - http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close"); + http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Connection: %s", + sp->doclose ? "close" : "keep-alive"); sp->wantbody = 0; } @@ -129,8 +129,8 @@ http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %.0f", sp->obj->age + sp->t_resp - sp->obj->entered); http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish"); - if (sp->doclose != NULL) - http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close"); + http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Connection: %s", + sp->doclose ? "close" : "keep-alive"); } /*--------------------------------------------------------------------*/
_______________________________________________ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc