Reduce Fail2ban Memory Usage

The initial fail2ban virtual memory overhead on my MediaTemple DV Developer server was approximately 350MB. While that is a lot, you’re not stuck with it. You can modify the over-sized default stack size by adding one line of code to the configuration file.

To limit the memory used by fail2ban, edit /etc/default/fail2ban and add this line to the end of the file.

ulimit -s 256

This sets the default stack size to 256 KB and lowers the memory consumption of fail2ban. Lastly, restart fail2ban.

sudo /etc/init.d/fail2ban restart

You can see the difference by entering the following command before and after the change is made.

ps -aux | grep fail2ban

Cheers!

I'm a Long Island, NY based Web and App Designer.

  • http://www.wealthesteem.org/ Paul Zagoridis

    Thanks I’ll try it. It’s using 1.15GB on my dev system