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 currently have a website running on Slicehost. It is running the MySource Matrix CMS which does take up a fair amount of resources. Every once in a while, I get an alert from slice host saying that my swap usage has been very high. And, when checking my site, it is crawling, sometimes not even able to visit it. So, I have to reboot the server and the site is back up and quick.

I did make a setting in Apache for max users as someone said that this might help. But I am getting worried when it happens like this. We really only have about 150 visitors a day, so it is not really a too many user issue, I would not think.

Currently I am running the 256 slice. What can I do to ensure that this does not continue to happen?

256 Slice Debian PHP5 Apache 2

share|improve this question

3 Answers 3

If you're hitting swap a lot that means you're running out of RAM. You can either upgrade your slice to something that has the resources your current setup requires, or you can sit at the box with top running and try to catch the app thats consuming so much RAM that your slice is hitting swap. If you can determine which program is getting out of control (it will probably be a php program that is being sloppy with memory management.

share|improve this answer

First reduce the MaxClients directive to a number your server can handle, and set MaxRequestsPerChild to an optimal value. You need to calculate theses value, try to find how much memory are consuming your Apache procesess.This should avoid the swapping. Also take a closer look on what's happening to your server when this problem arises using a monitoring tool to measure memory, cpu and number of httpd connections.

share|improve this answer
    
Do you have a monitoring tool you would recommend? I have used munin before... –  Zed Said Sep 24 '09 at 21:18
    
I use ganglia, but munin is a good choice, just install it in other server. Also you can use htop for real time monitoring on the same web server. –  HD. Sep 24 '09 at 21:49
    
HD, I have done this, and it still seems that I am running into this issue. How can I find out how much memory my apache processing are taking? Also, what tool would you recommend to monitor the cpu and http connections? –  Zed Said Oct 19 '09 at 23:41
    
Using htop (RES column) you can find the memory usage for each httpd process, also you can see a nice overview of what's happening on your server in real time. Munin or Ganglia can give you detailed stats for cpu,memory, http requests, etc. –  HD. Oct 20 '09 at 14:35

For the low-traffic usage you are describing, you should be fine with a small plan (256MB - 384MB). When Apache and MySQL are installed their default configs assume they are working with more RAM available to them which can cause problems. Use the following as a good starting point and adjust as necessary:

http://library.linode.com/troubleshooting/memory-networking

share|improve this answer

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.