Speed up Varnish miss

Kristian Lyngstol kristian at varnish-software.com
Tue Aug 30 10:24:42 CEST 2011

On Mon, Aug 29, 2011 at 12:52:05PM -0400, Drew wrote:
> A Varnish fetch to the back-end takes longer than not having varnish
> at all. Is this normal and if so is there a way to speed up cache
> misses?

Like the others have pointed out, a bit of overhead is natural.

However, there is one big factor here so far left unmentioned.

Varnish, by default, will fetch an entire object before it starts
sending it to the client. For a slow object (a large object fetched from
a slow web server, for instance), this will add a significant delay.

However, with Varnish 3.0.0, Varnish can stream these objects when there
is a cache miss or a pass. That means Varnish will start sending the
data to the client as the data arrives from the web server. This is not
enabled by default, and requires beresp.do_stream = true;.

Note that this doesn't apply to busy objects. In other words: if a
client is already fetching an object, and an other client requests the
same object, the first client will get the data on-the-fly, while the
second client has to wait.

Support for full streaming is work in progress and a working
implementation exists, though it is not yet merged with the master

- Kristian

More information about the varnish-misc mailing list