Multiple storage with multiple backends

Per Buer perbu at varnish-software.com
Fri May 18 13:01:36 CEST 2012


Hi,

On Fri, May 18, 2012 at 12:27 PM, Javier Casares <javier at casares.org> wrote:

> I'm readin this:
>
> -s [name=]type[,options]
>    Use the specified storage backend. See Storage Types for a list of
> supported storage types. This option can be used multiple times to
> specify multiple storage files. You can name the different backends.
> Varnish will then reference that backend with the given name in logs,
> statistics, etc.
>
> In my sysconfig file I have this (it's a demo try):
>
> -s malloc,128M \
> -s file,/var/lib/varnish/varnish_storage_1.bin,128M \
> -s file,/var/lib/varnish/varnish_storage_2.bin,512M"
>
> Is possible to asign in the VCL backends what kind of storage use in
> each backend, or by host or something similar? How can I do it?
>

Yes. Just give it a name (-s foo=file,...) and set beresp.storage in
vcl_fetch.

sub vcl_fetch {
   if (beresp.http.storage-hind ~ "bar") {
     beresp.storage = "bar";
   } else {
     beresp.storage = "foo";
  }
}

I'm not 100% sure about the quoting. This is untested code.

-- 
Per Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
*Varnish makes websites fly!*
Whitepapers <http://www.varnish-software.com/whitepapers> |
Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
Twitter <https://twitter.com/varnishsoftware>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120518/1b0b2054/attachment.html>


More information about the varnish-misc mailing list