Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Pipe mode and pass mode in varnish

what is pipe mode and pass mode in varnish-cache ... I have been trying to refer to this link to understand varnish. I somewhat understand pass but I'd like a better explanation.. http://spin.atomicobject.com/2013/01/16/speed-up-website-varnish/

like image 379
J-D Avatar asked Mar 19 '14 06:03

J-D


People also ask

What is Varnish pipe?

If you want to stream objects, such as videos, you'll want to use pipe to avoid timeouts. Using pipe means Varnish stops inspecting each request, and just sends bytes straight to the backend. There are multiple gotchas when using pipe, so be sure to checkout using pipe in the Varnish docs.

What is VCL in Varnish?

Varnish Configuration Language (VCL) is a domain-specific language designed for use in Varnish. VCL allows users to configure Varnish exactly how they see fit. It gives total control of content caching policies, HTTP behavior, and routing.

How do I know if Varnish is running?

HTTP headers specific to Varnish. Out of the box, Varnish already emits one useful header for checking cache status of each request: X-Varnish . All you need to know is how to interpret its value: A value with two integers means that the page was delivered from the cache.

What is Varnish software used for?

Varnish Cache is a powerful, open source HTTP engine/reverse HTTP proxy that can speed up a website by up to 1000 percent by doing exactly what its name implies: caching (or storing) a copy of a webpage the first time a user visits.


1 Answers

Pass mode is very common in Varnish, and just tells Varnish to pass the request to the backend rather than try and serve it from cache. This is used for dynamic pages that should not be cached. Example:

sub vcl_recv {
    if (req.url ~ "^/myprofile") {
        return (pass)
    }
}

Pipe mode is quite different and is rarely used. If you want to stream objects, such as videos, you'll want to use pipe to avoid timeouts. Using pipe means Varnish stops inspecting each request, and just sends bytes straight to the backend. There are multiple gotchas when using pipe, so be sure to checkout using pipe in the Varnish docs.

Example:

sub vcl_recv {
    if (req.url ~ "^/video/stream/") {
        return (pipe)
    }
}

sub vcl_pipe {
    # http://www.varnish-cache.org/ticket/451
    # This forces every pipe request to be the first one.
    set bereq.http.connection = "close";
}
like image 185
Brandon Wamboldt Avatar answered Oct 13 '22 19:10

Brandon Wamboldt