Keepalive Sessions

Kristian Lyngstol kristian at varnish-software.com
Mon Dec 20 09:19:01 CET 2010


On Mon, Dec 20, 2010 at 08:04:33AM +0100, Frank Helmschrott wrote:
> i wonder how the thing is with keep alive sessions from apache when
> using it behind a varnish cache server. Doesn't keep alive make sense
> here as all the connection come from the varnish cache (one source)
> instead of the users (many sources). I don't know how these sessions
> work in detail but thats what came to my tired mind on early monday
> morning :)

Varnish uses (and likes) keep-alive to the back-end. You want your backend
to support keep-alive, since there's little point in re-establishing
connections all the time. There's a "backend connections reused" counter
that'll tell indicate how efficient Varnish is at taking advantage of
keep-alive (and recycled, which is much the same thing).

There's one exception, though: When you are using pipe (not pass), you want
to set "connection: close" in vcl_pipe to disable keep-alive. This is
because Varnish only sees the first request in a piped session - if the
first request is piped, the next requests will be too. This is a problem
if you need different backends for the requests; have cached the
subsequent requests; or if you need the x-forwarded-for header or other
varnish-manipulated headers on the subsequent requests.

But other than pipe, you really want to use keep-alive.

- Kristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20101220/a4aa9aba/attachment-0003.pgp>


More information about the varnish-misc mailing list