Using cron to purge cache

MrBiTs mrbits.dcf at gmail.com
Fri Mar 25 11:38:51 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/25/2011 06:54 , Per Buer wrote:
> Hi Nuno.
>
> On Fri, Mar 25, 2011 at 10:47 AM, Nuno Neves <nfn at gmx.com> wrote:
>> Hello,
>>
>> I have a file named varnish-purge with this content that it's executed daily
>> by cron, but the objects remain in the cache, even when I run it manually.
>> --------------------------------------------------------------------------------------------
>> #!/bin/sh
>>
>> /usr/bin/varnishadm -S /etc/varnish/secret -T 0.0.0.0:6082 "url.purge .*"
>
> url.purge will create what we call a "ban", or a filter. Think of it
> as a lazy purge. The objects will remain in memory but killed during
> lookup. If you want to kill the objects from cache you'd have to set
> up the ban lurker to walk the objects and expunge them.
>
> If you want the objects to actually disappear from memory right away
> you would have to do a HTTP PURGE call, and setting the TTL to zero,
> but that means you'd have to kill off every URL in cache.
>

I think we can do a nice discussion here. First, and this is a big off-topic here, if I need to purge all contents from time to
time, it's better to create a huge webserver structure, to support requests, change the application a little to generate static
pages from time to time to not increase the database load and forget about Varnish. But this is discussion to another list, another
time.

Second, is this recommended ? I mean, purge all URL, all contents in cache will do varnish to request this content again to backend,
increasing server load and it can cause problems. What to you guys think about it ?

I think it is better to have a purge system (like a message queue or a form to kill some objetcs) to remove only really wanted objects.

If you need to purge all varnish contents, why not just restart varnish from time to time ? But, again, all backend issues must be
considerated here.


- -- 

LLAP

.0. MrBiTs - mrbits.dcf at gmail.com
..0 GnuPG  - http://keyserver.fug.com.br:11371/pks/lookup?op=get&search=0x6EC818FC2B3CA5AB
000 http://www.mrbits.com.br


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iQEcBAEBCAAGBQJNjHC7AAoJEG7IGPwrPKWr3kkH/1zim9haorjg4qbrLeefsyjd
chBzbCdNwNUPqjbKW+V0hyw7OZY80boMCfD7ZIWgWd+Dy5kCou01D7qebRGYGHt9
oaSmgNFXISMUwOtZwl4F5uKsKhxH7ZtBdJncomoSz3+Apl9yY3gB0aYYfNoi8YoS
btgWsNKBzWQTR2pFUz8dYqumrr0aQU3sQRhqBQ7YU165GnhzBSAOxQuTXwM5Lp+j
IPLwfWuPaPdSt5nhueDrovdQqHGctWDjkB2JGpi0M8ALvPHETKIZA5oBMHXuXhXY
uURPvOsLm2bFmhzDYG3Zr0sJ81ek4K7T2LXd4yT9uiqisnyd5WjbfTH6XS4keDY=
=x2+0
-----END PGP SIGNATURE-----



More information about the varnish-misc mailing list