varnishd invoked oom-killer

Pierig Le Saux pierig56 at gmail.com
Wed Aug 10 15:49:13 CEST 2011


Hello,

I am fairly new to varnish, and am trying to troubleshoot some sort of memory leak I have with varnishd.

The server used is a vmware guest with dual cpu and 5gigs of ram. The traffic it handles is around 20Mbits, and it achieves a cache hit rate of approximately 40%.

As you can see in the following vcl, we are using an in house module that checks for tokens - However if we bypass the module, we still have the out of memory problem.

I have tried varnish 3beta1,3beta2, 3.0-1  and even svn version from 20110808.

I am certain it is only a configuration mistake, since many of you out there aren't facing memory leak issues.

Could you please have a rapid look at my following configurations and see if anything jumps to your attention?

Best Regards

Pierig Le Saux


----VCL CONTENT----

import securelink;
import std;

backend default {
     .host = "xxxxxxxxx";
     .port = "80";
     .saintmode_threshold = 20000;
     .probe = {
                .request =
                "GET /test.html HTTP/1.1"
                "Host: lbcheck"
                "Connection: close";
                .timeout = 0.2 s;
                .interval = 1s;
                .window = 4;
                .threshold = 2;
        }
}

sub vcl_recv {
        if (req.request == "GET" && req.url ~ "/xxxxx") {
                if (securelink.is_url_invalid(req.url, req.http.User-Agent) != 0) {
                        error 403;
                }
                # remove cookie
                if (req.http.Cookie) {
                        unset req.http.Cookie;
                }
                # remove query params
                set req.url = regsub(req.url, "\?.*", "");
                # rewrite url to bypass nginx securelink
                set req.url = regsub(req.url, "\/xxxxx", "\/vnshxxxxx");
                set req.grace = 2h;
                return(lookup);
        }
        if (req.url == "/test.html") {
                error 200 "OK";
        }
        if (req.url == "/crossdomain.xml") {
                set req.grace = 2h;
                return(lookup);
        }
        if (req.request == "GET") {
                set req.http.X-Varnish-NotCached = "Find why please";
                return(pass);
        }
        error 503 "Mostly unexpected";
}

sub vcl_hash {
        hash_data(req.url);
        return (hash);
}

sub vcl_fetch {
        set beresp.grace = 2h;

        if (req.url == "/crossdomain.xml") {
                set beresp.ttl = 5m;
        }
}

sub vcl_deliver {
        unset resp.http.Server;
        unset resp.http.X-Varnish;
        unset resp.http.Via;
        unset resp.http.X-Mod-Smooth-Streaming;
        unset resp.http.Connection;
        set resp.http.Connection = "close";
	set resp.http.X-Who = resp.http.X-Who + ",005";
        return(deliver);
}

sub vcl_error {
     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>"} + obj.status + " " + obj.response + {"</title></head><body></body></html>
"};
     return(deliver);
}


----VARNISHD DAEMON OPTS----
VARNISH_VCL_CONF=/etc/varnish/varnish.vcl

MEMLOCK=82000

VARNISH_LISTEN_ADDRESS=
VARNISH_LISTEN_PORT=80

VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=8888

VARNISH_MIN_THREADS=4

VARNISH_MAX_THREADS=200

VARNISH_THREAD_TIMEOUT=60

VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin

VARNISH_STORAGE_SIZE=3G

VARNISH_STORAGE="malloc,${VARNISH_STORAGE_SIZE}"
 
VARNISH_TTL=1800
 
VARNISH_PARAMETERS="-p thread_pools=2 -p thread_pool_min=200 -p thread_pool_max=4000 -p cli_timeout=30 -p session_linger=50 -p sess_workspace=262144 -p ping_interval=60"

VARNISH_DIR="/var/run/varnish" 

DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
             -f ${VARNISH_VCL_CONF} \
             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
             -t ${VARNISH_TTL} \
             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
             -S ${VARNISH_SECRET_FILE} \
             -s ${VARNISH_STORAGE} \
             -n ${VARNISH_DIR} \
             ${VARNISH_PARAMETERS}"






More information about the varnish-misc mailing list