[varnish] Defining varnish + proposals for the FAQ page

BUSTARRET, Jean-francois jfbustarret at wat.tv
Fri Nov 23 17:07:17 CET 2007


As promised, here is a proposal for a new definition of what varnish is for the FAQ (links in <>, changes in bold, comments in []). I did compile some mails exchanged the last days on varnish-dev, credit for this goes to many people.
 
My mother tongue not being english, there might be quite a few spelling/grammatical errors.

What is varnish ? [new]

Varnish is a HTTP accelerator : a high performance HTTP server to be put in front of a slow one (like apache) to speed up an existing website. Rather than a true reverse proxy (as in <RFC2616>), varnish is a "HTTP surrogate", as defined in the <Edge Architecture Specification> w3c draft. Varnish can be very easily adapted to any website, and <become a reverse proxy> with a few lines of configuration [link to the section in the FAQ, below]. 

Why bother with Varnish - why not use Squid ? [modified]

Varnish was written from the ground up to be a high performance HTTP accelerator. Squid is a forward proxy that can be configured as a reverse proxy, that, as a side effect, can provide HTTP accelerating features. Besides - Squid is rather old, bloated and designed like computer programs where supposed to be designed in 1980. Please see <ArchitectNotes <http://varnish.projects.linpro.no/wiki/ArchitectNotes> > for details.

How do I configure varnish to act like a classical reverse proxy ? [new]

Here is a sample VCL to do this :
 
backend default {
                set backend.host = "backend.example.com";
                set backend.port = "http";
}
 
sub vcl_recv {
 
        if (req.request != "GET" && req.request != "HEAD") {
                pipe;
        }
        if (req.http.Expect) {
                pipe;
        }
        if (req.http.Authenticate) {
                pass;
        }
        if (req.http.Cache-Control ~ "no-cache") {
                pass;
        }
        lookup;
}
 
sub vcl_pipe {
        pipe;
}
 
sub vcl_pass {
        pass;
}
 
sub vcl_hash {
        set req.hash += req.url;
        set req.hash += req.http.host;
        hash;
}
 
sub vcl_hit {
        if (!obj.cacheable) {
                pass;
        }
        deliver;
}
 
sub vcl_miss {
            fetch;
}
 
sub vcl_fetch {
        if (!obj.valid) {
                error;
        }
        if (!obj.cacheable) {
                pass;
        }
        if (obj.http.Set-Cookie) {
                pass;
        }
        if (obj.http.Pragma ~ "no-cache" || obj.http.Cache-Control ~ "(no-cache|private)" ) {
                pass;
        }
        insert;
}
 
sub vcl_deliver {
        deliver;
}
 
sub vcl_timeout {
        discard;
}
 
sub vcl_discard {
        discard;
}

What do you think of this ?
 
Jean-François Bustarret
WAT - Responsable technique
http://www.wat.tv
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20071123/aee5df0f/attachment-0001.html>


More information about the varnish-misc mailing list