BAN - Memory consumption exploding under load

Hugues Alary hugues at
Wed Oct 26 20:22:51 CEST 2016

Hi there,

We're using Varnish 4.1.3 here and are running into an issue when using a
lot of BANs.

We make a heavy use of BAN-lurker friendly bans, and it seems that overtime
BANs accumulate.

They accumulate to the point where varnish suddenly starts using all the
memory available on the system and that only a reboot of the server fixes.
The CPU usage also seem to explode.

The accumulation of BANs seems to be happening when we have a sudden spike
in traffic triggering in turn a sudden spike in BAN requests.

Not sure how useful the following information is but:

I was able earlier to run `sudo varnishstat -1 | grep ban` on the server to
gather some information, but unfortunately lost all the exact numbers.

I do however recall seeing MAIN.bans, MAIN.ban_added and MAIN.ban_created
ever increasing and MAIN.ban_deleted staying to the same constant number.

MAIN.bans_persisted_bytes and MAIN.bans_persisted_fragmentation showed both
around 410MBytes.

We noticed a very similar issue on varnish 3.0.6 where sending too many BAN
requests to Varnish would make it crawl to a halt (without necessarily
eating all the memory and CPU though). We upgraded to Varnish 4.1.3 hoping
it would help, but seems like it didn't.

I also, thanks to varnishlog, realized that we were sending a lot of BAN
that were invalid regular expressions. I fixed the issue with the regular
expressions and varnishlog isn't showing errors anymore, but currently have
no idea if it had anything to do with my original issue.

Has anybody ever run into this issue? I found an old bug report reporting
the same kind of behavior:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list