0

I have a problem with new server.. I use VPS Centos with 1GB of ram and I use wordpress CMS.

The traffic <100 visitor/hour, but the apache have high load and make the server hang with zero free of ram and can't connect through ssh. I should reboot the vps to make it works

here is the load on Apache looks like

Tasks:  66 total,   1 running,  65 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.6%us, 12.3%sy,  0.0%ni, 48.1%id, 23.0%wa,  4.8%hi, 10.2%si,  0.0%
Mem:   1018776k total,   116620k used,   902156k free,     1236k buffers
Swap:  1048568k total,    1013052k used,  35516k free,    26628k cached
2949 apache    20   0  459m  42m 3732 D  3.0  4.2   0:09.23 httpd           
2959 apache    20   0  460m  29m 3744 D  2.0  3.0   0:02.72 httpd           
2968 apache    20   0  460m  26m 3808 D  2.0  2.6   0:02.27 httpd            
2972 apache    20   0  460m  24m 3784 D  2.0  2.5   0:02.44 httpd           
2986 apache    20   0  460m  29m 3784 R  2.0  2.9   0:02.40 httpd            
2969 apache    20   0  458m  29m 3864 D  1.6  3.0   0:02.63 httpd           
2974 apache    20   0  460m  25m 3820 D  1.6  2.6   0:02.43 httpd            
2990 apache    20   0  460m  23m 3920 D  1.6  2.4   0:02.36 httpd           
2994 apache    20   0  460m  31m 3756 D  1.6  3.2   0:02.62 httpd            
2956 apache    20   0  460m  26m 3740 D  1.3  2.7   0:02.73 httpd           
2957 apache    20   0  465m  22m 3644 D  1.3  2.3   0:02.80 httpd            
2967 apache    20   0  458m  24m 3764 D  1.3  2.5   0:02.60 httpd           
2970 apache    20   0  463m  25m 3764 D  1.3  2.6   0:03.07 httpd            
2971 apache    20   0  451m  22m 3792 D  1.3  2.3   0:02.47 httpd           
2973 apache    20   0  458m  25m 3768 D  1.3  2.6   0:02.52 httpd            
2987 apache    20   0  465m  20m 3772 D  1.3  2.1   0:03.02 httpd  

But sometimes the server have uptime more than 5-10hrs but after that the problems start

3
  • The "wait" time percentage is very high. You may want to install iotop and run it to look at what processes are using the storage (and how intensely).
    – pino42
    Nov 11, 2012 at 11:44
  • 1
    Not enough detail. Or units. What does after the domain resolve and <100/hour mean? Nov 11, 2012 at 11:55
  • Lots of uninterruptible sleeping processes. Bad. Nov 11, 2012 at 15:27

2 Answers 2

1

It could be a script on your site causing this. Check any plugins you might have installed.

Other than that, check the following articles for tweaking/optimizing Apache:

http://www.crucialp.com/resources/tutorials/server-administration/optimize-tweak-high-traffic-servers-apache-load.php

http://blog.oneiroi.co.uk/linux/apache/optimizing-apache-for-high-load-sites-part-2/

2
  • 1
    It would be better if you could summarise the posts here and include the links for reference. If the pages ever moved/got deleted then this answer's usefulness declines.
    – ChrisF
    Nov 11, 2012 at 20:03
  • The 2nd link is my blog, so I'll summarize real quick. 1) Disabling modules that you do not require saves a lot of memory, do this by checking httpd.conf or modules_enabled depending on your setup and commenting out / unlinking anything you do not actually need. (Slight necro posting I know but this appeared in a recent search hit, so this update is relevant).
    – Oneiroi
    Feb 7, 2013 at 15:46
1

Congratulations, you've managed to use nearly all of your swap space.

The first obvious problem here is that you went very deep into swap. This is probably what's causing the system to thrash so hard (lots of time spent in system, I/O wait and software interrupts). It looks like you killed some processes before this top output, though, so some memory was freed up.

First thing to do is to reduce the number of Apache processes that are running. You don't need that many for a small site, and it's just going to throw you deep into swap and kill your performance...which is what already happened. I would recommend you start very small and increase when it becomes necessary. An example:

StartServers            4
MinSpareServers         4
MaxSpareServers        10
MaxClients             25

This limits you to only serving 25 simultaneous requests (everyone else has to wait in line). But you are very unlikely to hit that unless your blog suddenly winds up on the front page of reddit or something. And if you expect that to happen on a regular basis, you need a bigger server and a professional sysadmin on call.

2
  • how about the MaxRequestsPerChild?
    – Adie
    Nov 11, 2012 at 15:13
  • @Adie That really doesn't have much of anything to do with this question. Nov 11, 2012 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .