The ban lurker

a huggy bear monster that tucks you in at night or something to give you real nightmares?

The ban lurker is an often overlooked feature of Varnish. It can help you keep a clean cache, by scaring seldom-accessed objects with long TTLs out into the open. Here they can be executed humanly by Varnish's flexible ban-purging mechanism. These little critters would otherwise hide in the corners until their TTLs expired.

Varnish features two different ways of getting rid of stale content. The direct purge is done through VCL rules, which would match an object directly through its hashed value, and setting the TTL to zero. The object would be removed from the cache immediately.

The other mechanism we call bans, and these are more flexible in that they can contain regular expressions over their URLs and headers, and match against entire trees of URLs. But these bans are not executed directly, rather objects are matched against them when they are looked up, and removed at that time if they match. In the case of seldom-accessed objects with long TTLs, these objects could never be banned and take up valuable cache space until their TTL expires.

This is where the ban lurker can help you, by actively walking the cache and matching objects against the ban list. You enable it by setting the 'ban_lurker_sleep' parameter of Varnish to some value other than zero. The parameter controls for how long it will sleep between each object found to be banned. Remember the name is no disgrace, the ban lurker has real value despite its unfortunate name.

With hopes of sweet dreams and no nightmares,
The Varnish Software development team

Are you ready to learn more about advanced cache invalidation in Varnish Plus? Or even ready to give Varnish Plus a test drive?

Try Varnish Plus now

11/11/10 11:19 AM by Martin Blix Grydeland

All things Varnish related

The Varnish blog is where the our team writes about all things related to Varnish Cache and Varnish Software...or simply vents.

SUBSCRIBE TO OUR BLOG

Recent Posts

Posts by Topic

see all