Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VPS running CentOS with some PHP sites. It's been running fine for weeks.

Recently it has become slower and slower (both website usage and when logged in via SSH). I have determined that it consistently uses more and more memory until it maxes out, then I have to reboot it, the memory usage goes back down, but then constantly climbs again.

What could be causing this and how can I analyze/solve it?

alt text

here is my top:

alt text

share|improve this question
add comment

2 Answers 2

While running top, you can press M (capital m) to sort by memory usage. You can watch for what is using the most memory there.

If Apache is the problem, you can work around memory leaks by setting or lowering the MaxRequestsPerChild parameter. This will kill off an Apache worker process after it has processed the specified number of requests.

share|improve this answer
add comment

Any program could be leaking memory; the best thing to do is to run sysstat (sar) at regular intervals via cron to capture process information periodically, and then look at the memory consumption of all your processes over time and see which one(s) are growing (or if there are more processes over time).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.