We were facing an httpd process overload problem that was occurring frequently every week on our server. The server is a shared hosting server holding Over 300 domains with Apache 2.2.3, MySql 5.0.45 and PHP 5.2.6. Occasionally httpd process were getting timed out, consuming 90% to 100% CPU load alone. Some PHP or Perl script that may be using too much of memory and CPU, but it was not possible or to check each and every script or put 300 domains offline one by one or remove any suspicious scripts because of that, since this was a production server.
“top” command returns only Apache’s child process, which is not as much helpful because it does not provide website name. But there is a way or a tool to trace down the name of the website that is causing the overload.
The Status module (mod_status) allows a server administrator to find out how well their server is performing. A HTML page is presented that gives the current server statistics in an easily readable form. If required this page can be made to automatically refresh.
The details given are:
- The number of children serving requests.
- The number of idle children.
- The status of each child, the number of requests that child has performed and the total number of bytes served by the child (*)
- A total number of accesses and byte count served (*).
- The time the server was started/restarted and the time it has been running for
- Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*).
- The current percentage CPU used by each child and in total by Apache (*).
- The current hosts and requests being processed (*).
Details marked “(*)” are only available with ExtendedStatus On.
Configure Apache mod_status
Open your httpd.conf file:
# vi /etc/httpd/conf/httpd.conf
Append / modify (or uncomment) directives as follows:
Deny from all
Allow from 10.0.0.0/8
Replace 10.0.0.0/8 with your Network IP range or workstation IP address. Save and close the file. Restart httpd server:
# service httpd restart
For full status report type:
# service httpd fullstatus
To view status report type URL – http://Server IP/server-status