Optimising memory used by Apache httpd process

bluecup

Member
May 30, 2014
17
2
53
cPanel Access Level
Website Owner
I am comparing our 2 VPS - one with Centos 6 and the other with Centos 7. I am trying to figure out how to reduce httpd memory consumption on Centos 7.

On Centos 6, the memory usage by httpd is something like this:

Code:
ps aux | grep 'httpd' | grep -v grep | awk '{print $6/1024 " MB\t\t"$11;}' | sort -n

8.17891 MB              /usr/sbin/httpd
15.789 MB               /usr/sbin/httpd
26.5048 MB              /usr/sbin/httpd
31.3944 MB              /usr/sbin/httpd
32.043 MB               /usr/sbin/httpd
32.477 MB               /usr/sbin/httpd
33.591 MB              /usr/sbin/httpd
33.602 MB              /usr/sbin/httpd
However on Centos 7, there is a big spike in memory usage:

Code:
ps aux | grep 'httpd' | grep -v grep | awk '{print $6/1024 " MB\t\t"$11;}' | sort -n

6.04591 MB              /usr/sbin/httpd
8.05974 MB              /usr/sbin/httpd
14.9014 MB              /usr/sbin/httpd
122.106 MB              /usr/sbin/httpd
124.843 MB              /usr/sbin/httpd
126.05 MB               /usr/sbin/httpd
127.709 MB              /usr/sbin/httpd
128.02 MB               /usr/sbin/httpd
128.98 MB               /usr/sbin/httpd
The directives on `httpd.conf`files on both the systems are pretty much identical - the prefork directives are same on both systems.

There are around equal number of sites hosted on each VPS. Perhaps only a couple of more sites hosted on Centos 7. However the sites with higher traffic are hosted on Centos 6.

The only significant difference I could find between the 2 systems, in terms of httpd, is that Centos 7 has more httpd modules installed than on Centos 6. Would that be the reason for the higher memory usage?

Any other suggestions would be greatly appreciated.

Thanks
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
17,470
2,843
363
cPanel Access Level
Root Administrator
Hey there! It's definitely possible that the additional modules would increase the memory - everything that's loaded into Apache needs to be in memory, so that would make sense.

It's often difficult to compare across machines, as hardware and software changes will be different, and there will definitely be changes across operating systems, so setting a true benchmark test in itself is a tricky process.

I don't have any specific details on performing that work, but if you think one of the machines isn't behaving properly we'd be happy to take a look on our end if you submit a ticket to our team.