RFC: bans with grace (aka softbans)

Tollef Fog Heen tfheen at varnish-software.com
Wed Oct 10 14:42:09 CEST 2012

Hi all,

The current implementation of bans in Varnish is fine for what it was
originally designed for: getting rid of chunks of your cache, fast and
in a manner that makes sure the matching objects are never seen again.
Over time, we've seen that people use it in many setups where it's less
imperative that the content is not seen again, that is, they want to
have the expressiveness of bans, but they also want grace to apply.

Our suggested solution for this is softbans: It's like a ban, but it
just expires the content by changing the TTL and does not touch any of
the grace or keep counters.

The current ban interface is:

 * ban(ban_expression) and ban_url(regex) in VCL.  
 * “ban <ban_expression>”, “ban.url <regex>” in varnishadm.
 * ban.list in varnishadm

Possible interface for adding softbans:

softban(regex); (in VCL)
“softban <regex>” (in varnishadm)

ban_url(URL) is an alias for ban(req.http.url ~ URL). Soft bans does not
have this alias.

Possible interface for listing softbans:

The varnishadm ban.list output is used for diagnostics. A ban.list
currently looks like this:

0x2aab74ae4540 1343650837.638163   468  obj.http.x-url ~ /article1.html
0x2aab74ae4500 1343650837.582181     0  obj.http.x-url ~ /article2.html
0x2aab74a9a540 1343649766.052658    54G obj.http.x-url ~ /article3.html

It is suggested that an extra “s” flag is introduced along with the
existing “G” (Gone) flag in the output. If deemed necessary for
completeness a “h” flag for hard bans may be introduced as well.

Comments are welcome,
Tollef Fog Heen
Technical lead, Varnish Software
t: +47 21 98 92 64

More information about the varnish-dev mailing list