I'm setup a instance in Amazon EC2, a ubuntu 10.04 server running apache2, php5 and mysql.
With less than 10 users using the system the server gets 20%, 30%, 40% of CPU load.
Using top I see in the firsts lines:
11121 www-data 20 0 71940 20m 11m S | 22.6 | 1.2 | 0:00.68 apache2
10108 www-data 20 0 72196 22m 12m S | 21.9 | 1.3 | 1:15.81 apache2
11122 www-data 20 0 71936 20m 11m S | 7.3 | 1.2 | 0:00.68 apache2
10111 www-data 20 0 72196 22m 12m S | 1.7 | 1.3 | 1:16.43 apache2
The CPU sum in this 4 lines are 53,5.
How can I see more detailed the processes?
How can I take a look into scripts running, the times it takes, the amont of processor each one consumes?
Thanks.
Use Task Manager to identify the source of high CPU utilization. Connect to your instance using Remote Desktop Protocol (RDP). Open Task Manager, and then select the CPU column to sort by CPU. Research any processes with high CPU utilization to determine whether they are using the expected amount of CPU.
I solved the problem by installing Apache mod Status - http://httpd.apache.org/docs/2.0/mod/mod_status.html. There you can see each PID on what URL is used.
Hope it helps anybody...
One way of looking at what it's doing is to use lsof ( you may have to install it ). To see what the processes in your example are accessing you would do this:
lsof -p 11121,10108,11122,10111
This will show you all of the files that process has open. Usually a high cpu on the apache process is due to something the website is trying to do server side.
You can use strace on the parent process to get a better idea of what its doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With