Why varnish caches as the cache is stopped?

georgi.int at gmail.com georgi.int at gmail.com
Mon Dec 14 17:47:28 CET 2015


Logs didn't help me. Now I faced the same problem with php file which 
didn't refresh until varnish restart. After I put the following in 
vcl_recv { the problem was solved:

if (req.url ~ 
"\.(png|gif|jp(e?)g|avi|flv|mp(e?)g|mp4|mp3|php|js)"){return(pass);}

But why I should add this after I have :

if (req.http.Authorization || req.http.Cookie) {
           return (pass);
       }
}

  and is there better solution than the first one that wills top 
completely the cache? Also, I use the same config file on all servers 
and there isn't such a problem now, only on this customer.

This is the log of the request befor I add the pass for certaing type of 
files:

    58 TxResponse   c OK
    58 TxHeader     c Server: Apache
    58 TxHeader     c Last-Modified: Mon, 12 Jul 2010 06:40:00 GMT
    58 TxHeader     c Content-Type: text/html
    58 TxHeader     c Content-Length: 5774
    58 TxHeader     c Accept-Ranges: bytes
    58 TxHeader     c Date: Mon, 14 Dec 2015 16:30:58 GMT
    58 TxHeader     c Connection: keep-alive
    58 Length       c 5774
    58 ReqEnd       c 2078285659 1450110658.014697075 
1450110658.033298254 1.481907368 0.018534422 0.000066757
    69 Debug        c herding
    69 SessionClose c timeout
    69 StatSess     c 212.233.149.2 54693 3 1 14 0 14 14 3823 211709
    16 Debug        c herding
    16 Interrupted  c ReqStart
    16 ReqStart     c 1.1.1.1 33259 2078285660
    16 RxRequest    c GET
    16 RxURL        c /testov.php
    16 RxProtocol   c HTTP/1.1
    16 RxHeader     c Host: siteofmycustomer.com
    16 RxHeader     c User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; 
rv:42.0) Gecko/20100101 Firefox/42.0
    16 RxHeader     c Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    16 RxHeader     c Accept-Language: en-US,en;q=0.5
    16 RxHeader     c Accept-Encoding: gzip, deflate
    16 RxHeader     c Connection: keep-alive
    16 RxHeader     c Cache-Control: max-age=0
    16 VCL_call     c recv lookup
    16 VCL_call     c hash
    16 Hash         c /testov.php
    16 Hash         c termoproekt.bg
    16 VCL_return   c hash
    16 Hit          c 2078285077
    16 VCL_call     c hit deliver
    16 VCL_call     c deliver deliver
    16 TxProtocol   c HTTP/1.1
    16 TxStatus     c 200
    16 TxResponse   c OK
    16 TxHeader     c Server: Apache
    16 TxHeader     c Content-Type: text/html; charset=UTF-8
    16 TxHeader     c Content-Length: 0
    16 TxHeader     c Accept-Ranges: bytes
    16 TxHeader     c Date: Mon, 14 Dec 2015 16:30:58 GMT
    16 TxHeader     c Connection: keep-alive
    16 Length       c 0


On 12/13/2015 12:24 PM, Guillaume Quintard wrote:
>
>
> On Dec 12, 2015 11:36, "georgi.int at gmail.com 
> <mailto:georgi.int at gmail.com>" <georgi.int at gmail.com 
> <mailto:georgi.int at gmail.com>> wrote:
> >
> > Hello,
> > I want to use varnish only as a proxy server, not to cache and have 
> the following in the configuration which should stop the cache 
> completely in vcl recv:
> >
> >   if (req.http.Authorization || req.http.Cookie) {
> >          return (pass);
> >      }
> > }
> >
> > the age header is 0, so it should not cache, but I notice that 
> varnish_storage.bin is full although, so something is cached - right? 
> On some servers with 32 GB ram29 is full and when I restart varnish 
> the ram is no more used, but I am not sure it these two things are 
> linked. Here is my /etc/sysconfig/varnish:
> >
> > # # The minimum number of worker threads to start
> > VARNISH_MIN_THREADS=50
> >
> > # # The Maximum number of worker threads to start
> > VARNISH_MAX_THREADS=1000
> >
> > # # Idle timeout for worker threads
> > VARNISH_THREAD_TIMEOUT=120
> >
> > # # Cache file location
> > VARNISH_STORAGE_FILE=/usr/local/varnish/lib/varnish_storage.bin
> >
> > # # Cache file size: in bytes, optionally using k / M / G / T suffix,
> > # # or in percentage of available disk space using the % suffix.
> > VARNISH_STORAGE_SIZE=1G
> >
> > # # Backend storage specification
> > VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
> >
> > # # Default TTL used when the backend does not specify one
> > VARNISH_TTL=120
> >
> > # # Varnish username
> > VARNISHUSER=varnish
> >
> > # # Varnish group name
> > VARNISHGROUP=varnish
> >
> > DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
> >              -T 
> ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
> >              -f ${VARNISH_VCL_CONF} \
> >              -S ${VARNISH_SECRET_FILE} \
> >              -s file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
> >
> >
> >
> > My questions are 1) does my conviguration stop completely the cache 
> and why then storage.bin is full?
> > 2) Why varnish eat so much ram - because of many requests, wrong 
> configuration or?
> >
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org <mailto:varnish-misc at varnish-cache.org>
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> Hi,
>
> The best way to investigate here is to look at the varnishlog and 
> check if indeed you end up in hit or miss instead of pass.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20151214/ccb805b1/attachment.html>


More information about the varnish-misc mailing list