varnish 4 to cache from multiple servers with different content

Sreenath Kodedala vedarad at
Wed Nov 23 15:59:51 CET 2016

Using varnish 4 to cache different content of same request from multiple
servers. It looks like it caches the first request from one server and
keeps giving the same content for every subsequent request.

doing curl gives response with two caches and different age.

Are there any factors like load or anything else for stickiness behaviour?
Used Jmeter and apache benchmark with load but still got the same behaviour.

Is my vcl_hash is good? Want to save the object with hash combination of
url and ip of backend server.

am I missing anything?

using round robin and hash_data. below is my config.vcl

backend s1{
    .host = "";

backend s2{
    .host = "";

sub vcl_init {
    new vms = directors.round_robin();

sub vcl_recv {
    set req.backend_hint = vms.backend();

sub vcl_hash {
    if ( {
    } else {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list