Mailing List Archive

Quick explanation of the VCL commands?
Hi everybody. Tomorrow I'll install Varnish on a big projects
preproduction site, to replace squid, mostly because I can't get Squid
to actually cache anything no matter how much documentation I read.
Varnish, despite the lack of documentation, I got up and modified the
configuration for my needs in an hour. :-)

However, I'm gonna spend tomorrow trying to optimize the configuration
and would like to understand VCL a bit better. Mostly, I wonder if
there is a document that explains, or if somebody can quickly explain,
what all the VCL commands, pipe, pass, insert_pass and so on do.

Just a quick explanation would suffice, I think. I tried to read the
source, but the lack of comments meant it didn't help. ;)

Thanks!

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.nuxeo.org/
Quick explanation of the VCL commands? [ In reply to ]
Hi Lennart,


> However, I'm gonna spend tomorrow trying to optimize the configuration
> and would like to understand VCL a bit better. Mostly, I wonder if
> there is a document that explains, or if somebody can quickly explain,
> what all the VCL commands, pipe, pass, insert_pass and so on do.

I don't thing a full documentation is there yet, but this man-page might
be useful:

http://varnish.projects.linpro.no/browser/trunk/varnish-cache/man/vcl.7

Also, have a look at PHK's presentation -- the diagram on page 20 is
helpful in understanding of what is going on:

http://phk.freebsd.dk/pubs/varnish_wip.pdf

Finally, the default VCL snippet is worth a look (from my notepad, might
have changed since):

--- snippet ---

sub default_vcl_recv {
if (req.request != "GET" && req.request != "HEAD") {
pipe;
}
if (req.http.Expect) {
pipe;
}
if (req.http.Authenticate || req.http.Cookie) {
pass;
}
lookup;
}

sub default_vcl_hit {
if (!obj.cacheable) {
pass;
}
deliver;
}

default_vcl_miss {
fetch;
}

sub default_vcl_fetch {
if (!obj.valid) {
error;
}
if (!obj.cacheable) {
insert_pass;
}
if (resp.http.Set-Cookie) {
insert_pass;
}
insert;
}

sub default_vcl_timeout {
discard;
}

--- snippet end ---

/Anton
Quick explanation of the VCL commands? [ In reply to ]
On 11/9/06, Anton Stonor <stonorn at giraffen.dk> wrote:
> Also, have a look at PHK's presentation -- the diagram on page 20 is
> helpful in understanding of what is going on:

Yeah, super, thanks!

Now all I need to know is what the difference between pass and pipe is...

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.nuxeo.org/
Quick explanation of the VCL commands? [ In reply to ]
On Friday 10 November 2006 00:01, Lennart Regebro wrote:
> On 11/9/06, Anton Stonor <stonorn at giraffen.dk> wrote:
> > Also, have a look at PHK's presentation -- the diagram on page 20 is
> > helpful in understanding of what is going on:
>
> Yeah, super, thanks!
>
> Now all I need to know is what the difference between pass and pipe is...


http://varnish.projects.linpro.no/svn/trunk/varnish-doc/en/varnish-architecture/article.xml

1.3.6 Pass and Pipe modes

Requests which the can not or should not be handled by
Varnish can be either passed through or piped through to
the backend.

Passing acts on a per-request basis and tries to make the
connection to both the client and the backend reusable.

Piping acts as a transparent tunnel and whatever happens
for the rest of the lifetime of the client and backend
connection is not interpreted by Varnish.
Quick explanation of the VCL commands? [ In reply to ]
On 11/10/06, Gaute Amundsen <gaute at pht.no> wrote:
> On Friday 10 November 2006 00:01, Lennart Regebro wrote:
> > On 11/9/06, Anton Stonor <stonorn at giraffen.dk> wrote:
> > > Also, have a look at PHK's presentation -- the diagram on page 20 is
> > > helpful in understanding of what is going on:
> >
> > Yeah, super, thanks!
> >
> > Now all I need to know is what the difference between pass and pipe is...
>
>
> http://varnish.projects.linpro.no/svn/trunk/varnish-doc/en/varnish-architecture/article.xml
>
> 1.3.6 Pass and Pipe modes
>
> Requests which the can not or should not be handled by
> Varnish can be either passed through or piped through to
> the backend.
>
> Passing acts on a per-request basis and tries to make the
> connection to both the client and the backend reusable.
>
> Piping acts as a transparent tunnel and whatever happens
> for the rest of the lifetime of the client and backend
> connection is not interpreted by Varnish.
>

Aha...! Clever. Thanks for the answer!

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.nuxeo.org/