Multiple storage with multiple backends

Javier Casares javier at casares.org
Fri May 18 13:21:53 CEST 2012


I'll try it!

If works i'll publish a sample code :)

Javier Casares
http://javiercasares.com/


2012/5/18 Per Buer <perbu at varnish-software.com>
>
> 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 | Video | Twitter
>
>



More information about the varnish-misc mailing list