varnish 2.1.4 swap and increase in objects:heads.

Taylan Develioglu tdevelioglu at ebuddy.com
Fri Oct 29 13:37:21 CEST 2010


Debian Lenny, Linux varnish0 2.6.33.7 #1 SMP Thu Sep 2 15:27:53 CEST
2010 x86_64 GNU/Linux

I have a strange situation on one of our varnish servers.

We recently raised the expiry on previously uncached content a
(Cache-Control: max-age=0, to Cache-Control: max-age=5).

The number of objects vs. heads increased and the system started
swapping (vm.swappiness=0).

http://lcontent.ebuddy.com/varnish/memory-week.png
http://lcontent.ebuddy.com/varnish/varnish_objects-week.png
http://lcontent.ebuddy.com/varnish/varnish_expunge-week.png


I don't understand why this is happening, bug maybe ?

DAEMON_OPTS="-a :27535 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -s file,/var/cache/varnish/sda/varnish_storage.bin,135G \
             -s file,/var/cache/varnish/sdb/varnish_storage.bin,135G \
             -s file,/var/cache/varnish/sdc/varnish_storage.bin,135G \
             -s file,/var/cache/varnish/sdd/varnish_storage.bin,135G \
             -s file,/var/cache/varnish/sde/varnish_storage.bin,135G \
             -s file,/var/cache/varnish/sdf/varnish_storage.bin,135G \
             -p thread_pools=4 \
             -p thread_pool_min=200 \
             -p thread_pool_max=2400 \
             -p thread_pool_add_delay=2 \
             -p lru_interval=20"



---vcl---
sub vcl_recv {
    unset req.http.cookie;
    unset req.http.Authorization;

    if (req.http.host ~ "^.*host.domain.com.*") {
        set req.http.host = "host.domain.com";
    }

    if (req.request == "HEAD") {
        return(pass);
    }

    if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
            error 405 "Not allowed.";
        }
        return(lookup);
    }

    if (req.request == "GET" && req.url == "/monitor") {
        error 200 "OK.";
    }

    if (req.backend.healthy) {
        set req.grace = 30s;
  } else {
        set req.grace = 48h;
    }

}

 sub vcl_fetch {
    if (beresp.status == 404 || beresp.status >= 300) {
         return (pass);
    }
    set beresp.grace = 48h;

 }

sub vcl_hit {
    if (req.request == "PURGE") {
        set obj.ttl = 0s;
        error 200 "Purged.";
    }
}

sub vcl_miss {
    if (req.request == "PURGE") {
        error 404 "Not in cache.";
    }
}
---EOF---





More information about the varnish-misc mailing list