Help debugging cacheability / ttl information?
Hi, We have a setup with varnish in front of a lighttpd+fastcgi combo. For some reason or other the application doesn't send any cache control headers. Instead of doing the sensible thing (prodding the developers to fix it in the backend) I have taken it upon myself to fix it via VCL. However my feeble attempts at being smart have so far failed elegantly, and I am left scratching my head a bit. What I really am looking for is some help with how to best debug the setup with regards to TTLs and cacheability. I'd like to be able to inspect a specific cached objects TTL to see if my "set obj.ttl" overrides actually work or not. What is the best way to do that? On the client I use firebug, so all headers and responess are readily available on that end. The reason I don't think everything is as it should is that the Age header is very low most of the time. For the record we are still at varnish 1.0.4 and here is the current VCL (I've taken out the stuff that was obviously not working anyway) : " backend default { set backend.host = "127.0.0.1"; set backend.port = "80"; } sub vcl_recv { if (req.request == "GET" && req.http.cookie) { lookup; } if (req.request == "GET" && req.url ~ "\.(gif|jpg|swf|css|js)$") { lookup; } } sub vcl_fetch { if (obj.ttl < 120s) { set obj.ttl = 120s; } if (resp.http.Set-Cookie) { insert; } } " Any help will be highly appreciated! Regards -- Denis ___ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc
Re: Help debugging cacheability / ttl information?
Denis Brækhus <[EMAIL PROTECTED]> writes: > What I really am looking for is some help with how to best debug the > setup with regards to TTLs and cacheability. I'd like to be able to > inspect a specific cached objects TTL to see if my "set obj.ttl" > overrides actually work or not. What is the best way to do that? You should get a varnishlog entry for the TTL computation when an object is retrieved from the backend, but there won't be a log entry for VCL changing the TTL... > On the client I use firebug, so all headers and responess are > readily available on that end. The reason I don't think everything > is as it should is that the Age header is very low most of the time. Instead of Firebug, have you considered using the following: while :; do wget -O/dev/null -S http://www.example.com/ 2>&1 | \ grep -i '^age:' ; sleep 5 ; done > For the record we are still at varnish 1.0.4 [...] 1.0.4 is almost a year old... why not 1.1.2? It has *much* better support for examining and modifying HTTP headers. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc
Re: Help debugging cacheability / ttl information?
- "Dag-Erling Smørgrav" <[EMAIL PROTECTED]> wrote: > > setup with regards to TTLs and cacheability. I'd like to be able to > > inspect a specific cached objects TTL to see if my "set obj.ttl" > > overrides actually work or not. What is the best way to do that? > You should get a varnishlog entry for the TTL computation when an > object is retrieved from the backend, but there won't be a log entry > for VCL changing the TTL... Ok, thanks. I guess what I am missing is a VCL debugger of some sort ;) But joke aside, the logentries are definitely helpful, there are only so many of them it is sometimes a bit overwhelming when you do not know exactly what you are looking for. > > On the client I use firebug, so all headers and responess are > > readily available on that end. The reason I don't think everything > > is as it should is that the Age header is very low most of the > time. > Instead of Firebug, have you considered using the following: > while :; do > wget -O/dev/null -S http://www.example.com/ 2>&1 | \ > grep -i '^age:' ; > sleep 5 ; > done Yes, I used curl in a similar fashion, and again the age header seemed to be a bit low. But it seems the minimum TTL parameter for varnishd "fixed" this situation for us. > > For the record we are still at varnish 1.0.4 [...] > 1.0.4 is almost a year old... why not 1.1.2? It has *much* better > support for examining and modifying HTTP headers. Well, 1.1.2 is being considered now, but up until 1.1.2 my impression has been 1.0.4 was the best build with regards to stability. We have had varnish nodes running for 6-8 months now without interruption or any problems whatsoever. List traffic sort of indicated there were always some snags with the 1.1.x builds, but 1.1.2 seems to be working fine for people I gather?! Regards -- Denis ___ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc
Re: Help debugging cacheability / ttl information?
"Denis Brækhus" <[EMAIL PROTECTED]> writes: > Well, 1.1.2 is being considered now, but up until 1.1.2 my > impression has been 1.0.4 was the best build with regards to > stability. We have had varnish nodes running for 6-8 months now > without interruption or any problems whatsoever. Until 1.1.2, 1.0.4 was the "stable" stable release. We're now running 1.1.2 in production at Linpro on many server clusters. > List traffic sort of indicated there were always some snags with the > 1.1.x builds, but 1.1.2 seems to be working fine for people I > gather?! That is my impression, yes. However, you may need: set req.http.connection = "close"; in front of "pipe", instead of the defaults. Especially if you do any kind of URL rewriting. -- Stig Sandbeck Mathisen, Linpro ___ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc
Re: Help debugging cacheability / ttl information?
Denis Brækhus <[EMAIL PROTECTED]> writes: > Dag-Erling Smørgrav <[EMAIL PROTECTED]> writes: > > You should get a varnishlog entry for the TTL computation when an > > object is retrieved from the backend, but there won't be a log entry > > for VCL changing the TTL... > Ok, thanks. I guess what I am missing is a VCL debugger of some sort ;) There is a VCL trace facility, but I'm not sure it will tell you what obj.ttl is set to. > But joke aside, the logentries are definitely helpful, there are > only so many of them it is sometimes a bit overwhelming when you do > not know exactly what you are looking for. Yes, most of them are listed in the man page, but they are not described. > > Instead of Firebug, have you considered using the following: > > while :; do > > wget -O/dev/null -S http://www.example.com/ 2>&1 | \ > > grep -i '^age:' ; > > sleep 5 ; > > done > Yes, I used curl in a similar fashion, and again the age header > seemed to be a bit low. But it seems the minimum TTL parameter for > varnishd "fixed" this situation for us. I can't remember if 1.0.4 can do this, but I think that in 1.1.2 you can add a header to the object so you can see the ttl: set obj.http.X-TTL = obj.ttl > List traffic sort of indicated there were always some snags with the > 1.1.x builds, but 1.1.2 seems to be working fine for people I > gather?! There should be fewer snags with 1.1 than with 1.0, and especially with 1.1.2 which had months to mature before release. There are still known bugs in it with known solutions, but merging those solutions would require merging large amounts of other code, and we would probably end up with 1.1.3 being *less* stable than 1.1.2. I believe that most of these bugs are documented in the change log. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc