March 21, 2014
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!

Copyright © 2022 Allan Kiezel – Long Island Web Designer & App Developer. All rights reserved.