Apache consuming all memory on server

Hi,

I have several servers with Virtualmin.

Now I’ve noticed that on a new server (6 months since installation). Apache is consuming all the memory in the server.

The server has 8 GB RAM and I have other servers which has 4 GB, and no issues with Apache eating all the memory.

Any idea what it could be?

We have like 59 sites. Some very small WP sites, and a few more busy sites, but nothing that should call for so much memory usages. All PHP Ressources are set to max 64 MB. Only 3 more than this.

Any ideas what to do?

Howdy,

What is the output of this command on your server:

free -m

Also, what distro/version are you using?

-Eric

         total       used       free     shared    buffers     cached

Mem: 7985 7798 186 3655 69 4550
-/+ buffers/cache: 3178 4806
Swap: 1022 634 388

Distro :
Ubuntu Linux 14.04.1
Virtualmin version 4.18
Kernel and CPU Linux 3.13.0-45-generic on x86_64

Howdy,

It looks like you still have about 4.5GB of free RAM on there (cached memory is considered free, though the Linux kernel uses it for cache until something else requires it).

So it doesn’t appear that you’re low on RAM.

What’s the output of this command as well though:

ps auxw | grep apache2

When I log in, I have this :

System information as of Tue Dec 8 10:14:43 CET 2015

System load: 0.74 Processes: 240
Usage of /: 35.0% of 236.11GB Users logged in: 0
Memory usage: 39% IP address for eth0: xxx.xxx.xx.183
Swap usage: 62%

This is the output.

www-data 508 0.0 0.0 243976 3380 ? S Dec07 0:13 /usr/sbin/apache2 -k start
root 8212 0.0 0.0 429824 4420 ? Ss Dec05 1:14 /usr/sbin/apache2 -k start
www-data 21182 0.0 0.0 433724 596 ? S Dec07 0:00 /usr/sbin/apache2 -k start
www-data 22044 0.0 0.0 432360 632 ? S Dec07 0:00 /usr/sbin/apache2 -k start

www-data 22279 0.0 0.0 433940 588 ? S Dec07 0:00 /usr/sbin/apache2 -k start
www-data 31407 0.3 0.1 434408 9740 ? S 20:25 0:00 /usr/sbin/apache2 -k start
www-data 31425 0.3 0.1 433092 8372 ? S 20:26 0:00 /usr/sbin/apache2 -k start
www-data 31884 0.5 0.1 433152 8420 ? S 20:27 0:00 /usr/sbin/apache2 -k start
www-data 31936 0.6 0.1 433448 8600 ? S 20:28 0:00 /usr/sbin/apache2 -k start
www-data 31957 0.4 0.0 432560 7628 ? S 20:28 0:00 /usr/sbin/apache2 -k start
www-data 31976 0.9 0.1 433780 9032 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 31977 0.7 0.1 433120 8412 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 31979 0.3 0.0 0 0 ? Z 20:29 0:00 [apache2]
www-data 31980 0.2 0.0 430496 5468 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 31982 0.2 0.0 432488 7592 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 31984 0.2 0.0 432560 7444 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 31985 0.2 0.0 431480 6384 ? S 20:29 0:00 /usr/sbin/apache2 -k start
www-data 32084 0.0 0.0 429856 3664 ? S 20:29 0:00 /usr/sbin/apache2 -k start

Howdy,

Yeah you don’t have a high system load, and you have plenty of free memory.

However, you could always try removing Apache modules you aren’t using to free up even more memory.

And sometimes simply restarting Apache can free up quite a bit of memory too.

-Eric