Server Running Out of Memory (CentOS 7.9)

SYSTEM INFORMATION
**OS type and version: CentOS 7.9, MariaDB 10.4, Nginx 1.20, PHP 7.4 and 7.2
**Webmin version: 1.973
**Virtualmin version: 6.16
**Related products version: Fail2ban Server

My serrver was running just fine for the last 2 years until I added approximately 10 new websites about 2 months ago. Now, my server keeps running out of memory every couple days and needs to reboot the instance. The culprit: “/usr/bin/python2 -s /usr/bin/fail2ban-server -xf start”
But why? Any idea what is going on here?
Thanks, Julius

how much ram is in the box. code grows over time and ram requirements grow. I have nearly 50 sites and i have 64 gigs installed in my current box.

I have 4GB RAM / 4GB Swap. When server boots it consumes about 45% of the RAM but as days go by that goes up to 87%. The only thing using up all that extra RAM is that Fail2ban server command.

This server only has 18 sites with only 3-4 sites that each get more than 4GB bandwidth use per month. I prefer not to have a single server hold all websites. I have other instances that have about the same number of sites and monthly use but they seem to hold out okay, though!

fail2ban being large is unrelated to adding more sites. But, it can grow pretty darned large…though it’s probably not as big as you think (it uses a memory map of some sort that just looks really huge, but it’s mostly able to be swapped out without harming anything).

On a system that struggles to run fail2ban, you might consider switching to sshguard. It’s much smaller, but does less (but the most important stuff is covered).

If you’re still having issues, this may help you. I had the same issue and I fixed it by following this. Virtualmin on Low Memory Systems – Virtualmin

Hey Joe,
I will try remove some unused modules on the server and swapping out Fail2ban before I try SSHGuard.
Thanks!

Thanks for the link. I will try to remove unused Apache modules as I use Nginx as the web server. Then see if this helps resolve the situation.

You won’t have any Apache modules, if you use nginx as the web server!

That’s what I was questioning too! Strangely enough, I do!

This is the list I get when I run “apachectl -M”

Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 allowmethods_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_anon_module (shared)
 authn_core_module (shared)
 authn_dbd_module (shared)
 authn_dbm_module (shared)
 authn_file_module (shared)
 authn_socache_module (shared)
 authz_core_module (shared)
 authz_dbd_module (shared)
 authz_dbm_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_owner_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cache_module (shared)
 cache_disk_module (shared)
 data_module (shared)
 dbd_module (shared)
 deflate_module (shared)
 dir_module (shared)
 dumpio_module (shared)
 echo_module (shared)
 env_module (shared)
 expires_module (shared)
 ext_filter_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 info_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_magic_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 remoteip_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 slotmem_plain_module (shared)
 slotmem_shm_module (shared)
 socache_dbm_module (shared)
 socache_memcache_module (shared)
 socache_shmcb_module (shared)
 status_module (shared)
 substitute_module (shared)
 suexec_module (shared)
 unique_id_module (shared)
 unixd_module (shared)
 userdir_module (shared)
 version_module (shared)
 vhost_alias_module (shared)
 dav_module (shared)
 dav_fs_module (shared)
 dav_lock_module (shared)
 lua_module (shared)
 mpm_prefork_module (shared)
 proxy_module (shared)
 lbmethod_bybusyness_module (shared)
 lbmethod_byrequests_module (shared)
 lbmethod_bytraffic_module (shared)
 lbmethod_heartbeat_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 proxy_connect_module (shared)
 proxy_express_module (shared)
 proxy_fcgi_module (shared)
 proxy_fdpass_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_scgi_module (shared)
 proxy_wstunnel_module (shared)
 systemd_module (shared)
 cgi_module (shared)
 php7_module (shared)

I have removed Apache and now a reboot starts the server with only 14% usage vs 55% before. I will give it a few days to see how memory usage changes before the final verdict.
Thank you all for your help!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.