Varnish 3.0.5 RAM/SWAP usage

geodni at free.fr geodni at free.fr
Wed Aug 6 15:40:55 CEST 2014


No problem, but the current stats are for a 100GB limited file storage

<--- varnishstat -1 --->
client_conn               1627         6.53 Client connections accepted
client_drop                  0         0.00 Connection dropped, no sess/wrk
client_req              858928      3449.51 Client requests received
cache_hit                 7864        31.58 Cache hits
cache_hitpass                0         0.00 Cache hits for pass
cache_miss              851064      3417.93 Cache misses
backend_conn              8511        34.18 Backend conn. success
backend_unhealthy            0         0.00 Backend conn. not attempted
backend_busy                 0         0.00 Backend conn. too many
backend_fail                 0         0.00 Backend conn. failures
backend_reuse           842558      3383.77 Backend conn. reuses
backend_toolate              0         0.00 Backend conn. was closed
backend_recycle         842559      3383.77 Backend conn. recycles
backend_retry                0         0.00 Backend conn. retry
fetch_head                   0         0.00 Fetch head
fetch_length            851064      3417.93 Fetch with Length
fetch_chunked                0         0.00 Fetch chunked
fetch_eof                    0         0.00 Fetch EOF
fetch_bad                    0         0.00 Fetch had bad headers
fetch_close                  0         0.00 Fetch wanted close
fetch_oldhttp                0         0.00 Fetch pre HTTP/1.1 closed
fetch_zero                   0         0.00 Fetch zero len
fetch_failed                 0         0.00 Fetch failed
fetch_1xx                    0         0.00 Fetch no body (1xx)
fetch_204                    0         0.00 Fetch no body (204)
fetch_304                    0         0.00 Fetch no body (304)
n_sess_mem                  10          .   N struct sess_mem
n_sess                       0          .   N struct sess
n_object                851064          .   N struct object
n_vampireobject              0          .   N unresurrected objects
n_objectcore            851064          .   N struct objectcore
n_objecthead            851064          .   N struct objecthead
n_waitinglist                2          .   N struct waitinglist
n_vbc                        1          .   N struct vbc
n_wrk                       10          .   N worker threads
n_wrk_create                10         0.04 N worker threads created
n_wrk_failed                 0         0.00 N worker threads not created
n_wrk_max                    0         0.00 N worker threads limited
n_wrk_lqueue                 0         0.00 work request queue length
n_wrk_queued                 0         0.00 N queued work requests
n_wrk_drop                   0         0.00 N dropped work requests
n_backend                    1          .   N backends
n_expired                    0          .   N expired objects
n_lru_nuked                  0          .   N LRU nuked objects
n_lru_moved               7865          .   N LRU moved objects
losthdr                      0         0.00 HTTP header overflows
n_objsendfile                0         0.00 Objects sent with sendfile
n_objwrite              858934      3449.53 Objects sent with write
n_objoverflow                0         0.00 Objects overflowing workspace
s_sess                    1627         6.53 Total Sessions
s_req                   858928      3449.51 Total Requests
s_pipe                       0         0.00 Total pipe
s_pass                       0         0.00 Total pass
s_fetch                 851064      3417.93 Total fetch
s_hdrbytes           227663896    914312.84 Total header bytes
s_bodybytes         9793599268  39331723.97 Total body bytes
sess_closed               1626         6.53 Session Closed
sess_pipeline                0         0.00 Session Pipeline
sess_readahead               0         0.00 Session Read Ahead
sess_linger             858927      3449.51 Session Linger
sess_herd                    0         0.00 Session herd
shm_records           58989035    236903.76 SHM records
shm_writes             2566131     10305.75 SHM writes
shm_flushes                  0         0.00 SHM flushes due to overflow
shm_cont                     0         0.00 SHM MTX contention
shm_cycles                  19         0.08 SHM cycles through buffer
sms_nreq                     0         0.00 SMS allocator requests
sms_nobj                     0          .   SMS outstanding allocations
sms_nbytes                   0          .   SMS outstanding bytes
sms_balloc                   0          .   SMS bytes allocated
sms_bfree                    0          .   SMS bytes freed
backend_req             851070      3417.95 Backend requests made
n_vcl                        1         0.00 N vcl total
n_vcl_avail                  1         0.00 N vcl available
n_vcl_discard                0         0.00 N vcl discarded
n_ban                        1          .   N total active bans
n_ban_gone                   1          .   N total gone bans
n_ban_add                    1         0.00 N new bans added
n_ban_retire                 0         0.00 N old bans deleted
n_ban_obj_test               0         0.00 N objects tested
n_ban_re_test                0         0.00 N regexps tested against
n_ban_dups                   0         0.00 N duplicate bans removed
hcb_nolock                   0         0.00 HCB Lookups without lock
hcb_lock                     0         0.00 HCB Lookups with lock
hcb_insert                   0         0.00 HCB Inserts
esi_errors                   0         0.00 ESI parse errors (unlock)
esi_warnings                 0         0.00 ESI parse warnings (unlock)
accept_fail                  0         0.00 Accept failures
client_drop_late             0         0.00 Connection dropped late
uptime                     249         1.00 Client uptime
dir_dns_lookups              0         0.00 DNS director lookups
dir_dns_failed               0         0.00 DNS director failed lookups
dir_dns_hit                  0         0.00 DNS director cached lookups hit
dir_dns_cache_full           0         0.00 DNS director full dnscache
vmods                        0          .   Loaded VMODs
n_gzip                       0         0.00 Gzip operations
n_gunzip                     0         0.00 Gunzip operations
sess_pipe_overflow           0          .   Dropped sessions due to session pipe overflow
LCK.sms.creat                1         0.00 Created locks
LCK.sms.destroy              0         0.00 Destroyed locks
LCK.sms.locks                0         0.00 Lock Operations
LCK.sms.colls                0         0.00 Collisions
LCK.smp.creat                0         0.00 Created locks
LCK.smp.destroy              0         0.00 Destroyed locks
LCK.smp.locks                0         0.00 Lock Operations
LCK.smp.colls                0         0.00 Collisions
LCK.sma.creat                1         0.00 Created locks
LCK.sma.destroy              0         0.00 Destroyed locks
LCK.sma.locks                0         0.00 Lock Operations
LCK.sma.colls                0         0.00 Collisions
LCK.smf.creat                1         0.00 Created locks
LCK.smf.destroy              0         0.00 Destroyed locks
LCK.smf.locks          1702141      6835.91 Lock Operations
LCK.smf.colls                0         0.00 Collisions
LCK.hsl.creat                0         0.00 Created locks
LCK.hsl.destroy              0         0.00 Destroyed locks
LCK.hsl.locks                0         0.00 Lock Operations
LCK.hsl.colls                0         0.00 Collisions
LCK.hcb.creat                0         0.00 Created locks
LCK.hcb.destroy              0         0.00 Destroyed locks
LCK.hcb.locks                0         0.00 Lock Operations
LCK.hcb.colls                0         0.00 Collisions
LCK.hcl.creat            16383        65.80 Created locks
LCK.hcl.destroy              0         0.00 Destroyed locks
LCK.hcl.locks           866800      3481.12 Lock Operations
LCK.hcl.colls                0         0.00 Collisions
LCK.vcl.creat                1         0.00 Created locks
LCK.vcl.destroy              0         0.00 Destroyed locks
LCK.vcl.locks                4         0.02 Lock Operations
LCK.vcl.colls                0         0.00 Collisions
LCK.stat.creat               1         0.00 Created locks
LCK.stat.destroy             0         0.00 Destroyed locks
LCK.stat.locks            1636         6.57 Lock Operations
LCK.stat.colls               0         0.00 Collisions
LCK.sessmem.creat            1         0.00 Created locks
LCK.sessmem.destroy            0         0.00 Destroyed locks
LCK.sessmem.locks           1839         7.39 Lock Operations
LCK.sessmem.colls              0         0.00 Collisions
LCK.wstat.creat                1         0.00 Created locks
LCK.wstat.destroy              0         0.00 Destroyed locks
LCK.wstat.locks            85891       344.94 Lock Operations
LCK.wstat.colls                0         0.00 Collisions
LCK.herder.creat               1         0.00 Created locks
LCK.herder.destroy             0         0.00 Destroyed locks
LCK.herder.locks               1         0.00 Lock Operations
LCK.herder.colls               0         0.00 Collisions
LCK.wq.creat                   2         0.01 Created locks
LCK.wq.destroy                 0         0.00 Destroyed locks
LCK.wq.locks                3749        15.06 Lock Operations
LCK.wq.colls                   0         0.00 Collisions
LCK.objhdr.creat          851070      3417.95 Created locks
LCK.objhdr.destroy             0         0.00 Destroyed locks
LCK.objhdr.locks         3420011     13734.98 Lock Operations
LCK.objhdr.colls               0         0.00 Collisions
LCK.exp.creat                  1         0.00 Created locks
LCK.exp.destroy                0         0.00 Destroyed locks
LCK.exp.locks             851312      3418.92 Lock Operations
LCK.exp.colls                  0         0.00 Collisions
LCK.lru.creat                  2         0.01 Created locks
LCK.lru.destroy                0         0.00 Destroyed locks
LCK.lru.locks             851070      3417.95 Lock Operations
LCK.lru.colls                  0         0.00 Collisions
LCK.cli.creat                  1         0.00 Created locks
LCK.cli.destroy                0         0.00 Destroyed locks
LCK.cli.locks                 94         0.38 Lock Operations
LCK.cli.colls                  0         0.00 Collisions
LCK.ban.creat                  1         0.00 Created locks
LCK.ban.destroy                0         0.00 Destroyed locks
LCK.ban.locks             851314      3418.93 Lock Operations
LCK.ban.colls                  0         0.00 Collisions
LCK.vbp.creat                  1         0.00 Created locks
LCK.vbp.destroy                0         0.00 Destroyed locks
LCK.vbp.locks                  0         0.00 Lock Operations
LCK.vbp.colls                  0         0.00 Collisions
LCK.vbe.creat                  1         0.00 Created locks
LCK.vbe.destroy                0         0.00 Destroyed locks
LCK.vbe.locks              17021        68.36 Lock Operations
LCK.vbe.colls                  0         0.00 Collisions
LCK.backend.creat              1         0.00 Created locks
LCK.backend.destroy            0         0.00 Destroyed locks
LCK.backend.locks        1710652      6870.09 Lock Operations
LCK.backend.colls              0         0.00 Collisions
SMF.s0.c_req             1702141      6835.91 Allocator requests
SMF.s0.c_fail                  0         0.00 Allocator failures
SMF.s0.c_bytes       21703835648  87163998.59 Bytes allocated
SMF.s0.c_freed                 0         0.00 Bytes freed
SMF.s0.g_alloc           1702142          .   Allocations outstanding
SMF.s0.g_bytes       21703843840          .   Bytes outstanding
SMF.s0.g_space       85670338560          .   Bytes available
SMF.s0.g_smf             1702143          .   N struct smf
SMF.s0.g_smf_frag              0          .   N small free smf
SMF.s0.g_smf_large             1          .   N large free smf
SMA.Transient.c_req            0         0.00 Allocator requests
SMA.Transient.c_fail           0         0.00 Allocator failures
SMA.Transient.c_bytes            0         0.00 Bytes allocated
SMA.Transient.c_freed            0         0.00 Bytes freed
SMA.Transient.g_alloc            0          .   Allocations outstanding
SMA.Transient.g_bytes            0          .   Bytes outstanding
SMA.Transient.g_space            0          .   Bytes available
VBE.default(10.10.11.28,,80).vcls            1          .   VCL references
VBE.default(10.10.11.28,,80).happy           0          .   Happy health probes

<--- config.vcl --->
backend default {
    .host = "10.10.11.28";
    .port = "80";
}

acl purge {
    "localhost";
    "10.10.11.0"/24;
}

# Request from client
sub vcl_recv {

    # allow PURGE from localhost and 10.10.11.0"/24
    if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
            error 401 "Not allowed.";
        }
        return (lookup);
    }
    if (req.request == "BAN") {
        if (!client.ip ~ purge) {
            error 401 "Not allowed.";
        }
        if (req.http.x-ban-url != "" && req.http.x-ban-host != "") {
            ban("req.url ~ " + req.http.x-ban-url + " && req.http.host ~ " + req.http.x-ban-host);
            error 200 "Banned " + req.http.x-ban-host + req.http.x-ban-url;
        }
    return (lookup);

}

sub vcl_hash {

    ##return (hash);
}

sub vcl_pipe {
    ### Do not keep connection opened after sending response
    set bereq.http.connection = "close";
    return (pipe);
}

sub vcl_pass {
    return (pass);
}

# Object retrieved from backend (origin)
sub vcl_fetch {
    
    remove beresp.http.Cache-Control;

    ### ROBOTS/SITEMAPS
    if (req.url ~ "^robots.txt") {
        set beresp.http.Cache-Control = "s-max-age=86400";
        set beresp.http.x-cache-type = "robots";
    } elsif (req.url ~ "^sitemap.xml") {
        set beresp.http.Cache-Control = "s-max-age=86400";
        set beresp.http.x-cache-type = "sitemaps";
    } elsif (req.http.host ~ "^corporate") {
        set beresp.http.Cache-Control = "no-cache";
        set beresp.http.Pragma = "no-cache";
    } elsif (req.url ~ "\.(bmp|gif|ico|jpeg|jpg|png)$") {
        set beresp.http.Cache-Control = "s-max-age=604800";
        set beresp.http.x-cache-type = "media-images";
    } elsif (req.url ~ "(avi|flv|mov|mepg|mpg|swf)$") {
        set beresp.http.Cache-Control = "s-max-age=604800";
        set beresp.http.x-cache-type = "media-videos";
    } elsif (req.url ~ "(doc|docx|docb|xls|xlsx|xlsb|pdf|txt)$") {
        set beresp.http.Cache-Control = "s-max-age=604800";
        set beresp.http.x-cache-type = "media-documents";
    } elsif (req.url ~ "(css|js)$") {
        set beresp.http.Cache-Control = "s-max-age=604800";
        set beresp.http.x-cache-type = "media-webs";
    } elsif (req.http.user-agent ~ "(iphone|itunes|nokia|symbian|android|mobile|opera mini|opera mobi|sony|windows ce)") {
        set beresp.http.Cache-Control = "no-cache";
        set beresp.http.Pragma = "no-cache";
    } else {
        set beresp.http.Cache-Control = "s-max-age=2592000";
        set beresp.http.x-cache-type = "nimportequoi";
    }

    # manipulate RESPONSE HEADERS here
    if (req.url ~ "^robots.txt") {
        set beresp.ttl = 86400s;
    } elsif (req.url ~ "^sitemap.xml") {
        set beresp.ttl = 86400s;
    } elsif (req.url ~ "\.(bmp|gif|ico|jpeg|jpg|png)$") {
        set beresp.ttl = 1800s;
    } elsif (req.url ~ "(avi|flv|mov|mepg|mpg|swf)$") {
        set beresp.ttl = 1800s;
    } elsif (req.url ~ "(doc|docx|docb|xls|xlsx|xlsb|pdf|txt)$") {
        set beresp.ttl = 1800s;
    } elsif (req.url ~ "(css|js)$") {
        set beresp.ttl = 1800s;
    }     else {
        # varnish default TTL is 120s
        set beresp.ttl = 2592000s; # for tests only
    }
      # Allow for Ban Lurker support.
    set beresp.http.x-url = req.url;
    set beresp.http.x-host = req.http.host;
  
    return (deliver);
}

sub vcl_deliver {

    set resp.http.Server = "Tartempion/1.0.1";
    remove resp.http.x-Varnish;
    remove resp.http.Via;
    remove resp.http.x-Powered-By;
    remove resp.http.x-url;
    remove resp.http.x-host;
    remove resp.http.x-cache-type; # remove x-http specific media qualifier
    set resp.http.Cache-Control = "max-age=2592000";
    
    return (deliver);
}


# Matching object in cache
sub vcl_hit {
    if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
    }
    return (deliver);
}

# object was not in cache until now
sub vcl_miss {
    if (req.request == "PURGE") {
        # to PURGE all variants
        purge;
        error 200 "Purged.";
    }
    return (fetch);
}





> Hi,
> 
> Can you provide varnishstat output and vcl ? This will help for
> diagnostic.
> 
> Regards,
> Thierry
> 
> -----Message d'origine-----
> De : varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org
> [mailto:varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org]
> De la part de geodni at free.fr
> Envoyé : mercredi 6 août 2014 14:19
> À : varnish-misc at varnish-cache.org
> Objet : Re: Varnish 3.0.5 RAM/SWAP usage
> 
> > I run a similar configuration except instead of file I use
> > 
> > malloc,26G
> > 
> > Have you tried that? does it react the same?
> 
> Hi,
> I tried that and the system became unstable after 3 minutes. I had to
> reboot because of <defunct> processes appears after that. No
> hardware failure nor specific system log. After the reboot, I made
> another injection test with "file" storage.
> 
> My conclusion is that Varnish really eats 1GB per 1 million objects
> but it also consume 22GB RAM for the rest of its activity !!!
> What the hell is it doing with 22GB of RAM ? 80MB for SHM logs, 100MB
> for threads ok but what about the rest ?
> 
> The platform I use runs at 2k requests per second for one injection
> job. One thing I can do is limiting "file"  storage to 100GB to be
> sure the system won't use SWAP. I am currently running this test.
> 
> Regards,
> Denis
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> 



More information about the varnish-misc mailing list