Bans vs. Purges (was RE: lurker?)

Poul-Henning Kamp phk at
Thu Jun 30 14:04:07 CEST 2011

In message <6D2C830A0941EA40B6B483FE6EC98ADBC28A6B at>, =?iso-88
59-1?Q?Lars_J=F8rgensen?= writes:

>3. User requests index.html. The current object in the cache is banned, so a new version is fetched, stored and deliverd

... and the banned object is expired immediately.

>What is the purpose of banning an object when you could just delete it?

Banning allows you to use a regular expression on any header you want.

"just deleting .*[.].jpg" would take walking over the entire cache
to find all matching objects.

Varnish does this with "lazy evaluation", we only check when we are
about to deliver an object.  This minimizes the work, for instance
objects that expire after then ban was entered without being hit in
the meantime, are not checked.

Purging works by doing a lookup, so you can only do it with a
hash-value (typically URL+Host:), and it expires the objects it find.

Purging is much cheaper, because we can go directly after the objects
we want.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list