Pascal Robert
2010-Nov-26 21:06 UTC
[CentOS] Checking what's running inside a httpd process
I'm trying to fix a CentOS (5.5 x86_64) VM that we have where it become unstable due to swapping. But I did notice something: I have 10 httpd processes, and 5 of them are using 13 MB of resident memory, the other are using between 91 and 96 MB of RAM. I find it quite strange to see such differences in RAM usage. I ran a "lsof -P -p" on the processes, and I didn't see any major differences, so I'm wondering what is the best way to know what the processes are doing?
Nicolas Ross
2010-Nov-26 22:37 UTC
[CentOS] Checking what's running inside a httpd process
Bonjour Robert. From experience with this kind of problems, you need to check what script (php or other) is served by that process at the moment it takes that much ram. The first thing you need to look is was the httpd process is responding to. If it's not, switch the ExtendedStatus to on, and then permit the access to /server-status to your station or network. Now, access the servername/server-status page in your web browser. You will see there what is the virtualhost (if any) and query that is serving for what process id. If you used your own compile of apache, it'll be compiled with mpm=prefork, and so one precess will have one thread and it'll be easier to spot. If it is compiled with mpm=worker (I don't know if centos' httpd compiled that way), then each process will serve many thread. If the process you examin is serving several page, it'll be more difficult to spot. From the number of process you have, either it's a low-traffic server or it use mpm=worker. If you got 10 process at 15 megs, plus one at 100 megs, that sums up to 250 megs. How much memory you server has ? Now that you have identified that, you need to trace where the memory hug is in that particular language. One of the advantage of mpm=prefork is that it isolates potential problem from one process to the other, but it takes more ram. So if you server is compiled with mpm=prefork, you can re-compile it with mpm=worker, it'll take less ressources on the server side. If your're using php, then you must re-compile php as well. Best regards, Nicolas Le 2010-11-26 ? 16:06, Pascal Robert <probert at macti.ca> a ?crit :> I'm trying to fix a CentOS (5.5 x86_64) VM that we have where it become unstable due to swapping. But I did notice something: I have 10 httpd processes, and 5 of them are using 13 MB of resident memory, the other are using between 91 and 96 MB of RAM. I find it quite strange to see such differences in RAM usage. I ran a "lsof -P -p" on the processes, and I didn't see any major differences, so I'm wondering what is the best way to know what the processes are doing? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos
Nicolas Ross
2010-Nov-26 22:48 UTC
[CentOS] Checking what's running inside a httpd process
Also, a thing I've notice is that httpd process tend not to relase it's used memory very fast. So if you see that the process is not doing much (via server-status), you can safely kill it. The parent httpd process will create a new one when needed. Regards, Nicolas Le 2010-11-26 ? 16:06, Pascal Robert <probert at macti.ca> a ?crit :> I'm trying to fix a CentOS (5.5 x86_64) VM that we have where it become unstable due to swapping. But I did notice something: I have 10 httpd processes, and 5 of them are using 13 MB of resident memory, the other are using between 91 and 96 MB of RAM. I find it quite strange to see such differences in RAM usage. I ran a "lsof -P -p" on the processes, and I didn't see any major differences, so I'm wondering what is the best way to know what the processes are doing? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos