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've read just about every blog post and serverfault answer relating to this, but have seen absolutely zero improvements to the server's CPU or Memory usage so I feel like I'm missing something.

At first I thought this was a WP issue. I replicated the remote server using Vagrant on my machine and the site WHIPS. It's damn fast. I don't know if that's because the VM is using my processor, but the Vagrant VM has lower memory than the remote VPS.

Beyond that, they're using the same version of Ubuntu, same Apache modules, same server configurations seen below. I set up the remote server over a year ago, so perhaps there's something I'm obviously not checking for? I've run through apt-get dist-upgrade, as well as apt-get autoremove on both Linode and Vagrant VM.

Linode VPS:
Ubuntu 10.04
Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz 8 cores
1.47 GB real mem, 256 MB swap mem

Thankfully, the server (usually) doesn't lock up, but it's incredibly slow during time-to-first-byte. Here's what top looks like

top - 06:41:36 up 2 days, 14:02,  1 user,  load average: 6.12, 6.16, 5.75
Tasks: 128 total,   6 running, 122 sleeping,   0 stopped,   0 zombie
Cpu(s): 17.3%us,  5.2%sy,  0.0%ni, 30.7%id,  7.5%wa,  0.0%hi,  0.1%si, 39.3%st
Mem:   1546512k total,  1157032k used,   389480k free,    27964k buffers
Swap:   262140k total,    72840k used,   189300k free,   779308k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
 9276 www-data  20   0  650m 108m  84m R  101  7.2   6:48.42 apache2                                                                          
 9203 www-data  20   0  646m 122m 102m R   64  8.1   7:10.95 apache2                                                                          
 9208 www-data  20   0  653m 136m 109m R   56  9.0   7:50.82 apache2                                                                          
 9207 www-data  20   0  666m 148m 110m S   51  9.8   7:45.71 apache2                                                                          
 9201 www-data  20   0  656m 124m  95m R   49  8.3   9:09.42 apache2                                                                          
 9204 www-data  20   0  645m 107m  88m D   47  7.1  10:12.04 apache2                                                                          
 9202 www-data  20   0  656m 131m 101m S   45  8.7   9:36.33 apache2                                                                          
 2337 mysql     20   0  165m  41m 3028 S   29  2.8   1064:57 mysqld                                                                           
    7 root      20   0     0    0    0 R    6  0.0  78:57.47 rcu_sched                                                                        
 2734 root      20   0 33304 4452 1904 S    2  0.3  14:52.61 newrelic-daemon                                                                  
 9498 deploy    20   0  2632 1224  932 R    1  0.1   0:00.06 top                                                                              


KeepAlive Off
HostnameLookups Off
Timeout 30

<IfModule mpm_prefork_module>
   StartServers         3
   ServerLimit          12
   MinSpareServers      2
   MaxSpareServers      3
   MaxRequestsPerChild  300
   MaxClients           12

Increasing MaxRequestsPerChild results in swapping almost instantly.


; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 32M


key_buffer              = 24M
max_allowed_packet      = 1M
thread_stack            = 64K
thread_cache_size       = 8
table_cache             = 4
sort_buffer             = 4M
net_buffer_length       = 2K

share|improve this question
obviously not a solution for everyone, but we upgraded the VPS from Linode 1024 to Linode 2048 and are getting the performance we hoped for. –  zack Apr 10 at 7:42

2 Answers 2

The first thing I noticed is 39.3%st -- that's CPU steal, which means the hypervisor is giving CPU time to another VM on the same physical machine. I'd move this VM to another host machine. You'll have to talk to the provider about how to do that.

Regarding the RAM, you should use an opcode cache like APC. You should also switch from mod_php to FPM. A value of 12 for MaxClients seems extremely low, and the fact that increasing MaxRequestsPerChild (# of requests a process will handle before being recycled) causes the system to swap could indeed be a sign of a memory leak -- you'd have to inspect/profile the code to solve it.

In general though, 1.47 GB is a small amount of RAM for running a busy PHP app with a local MySQL server. You may simply need a bigger box.

share|improve this answer
"which means the hypervisor is giving CPU time to another VM on the same physical machine" — wow! did not know this. good to know. –  zack Mar 31 at 12:11
I did forget to mention that I am using APC. switching from mod_php to FPM is one thing I haven't tried as it seemed like a bigger issue if this could be solved somewhere else. –  zack Mar 31 at 12:14
Switching to FPM is unlikely to make it any faster - if anything I wasould expect to see an increase in latency and memory usage. –  symcbean Mar 31 at 12:35

Generally, questions like this should be closed as way too broad.

However this is very interesting:

Increasing MaxRequestsPerChild results in swapping almost instantly

...which points to a memory leak.

PHPs architecture makes memory leaks relatively uncommon - but they can occur in shm. But if the leak were occurring in PHP I wouldn't expect it to be affected by MaxRequestsPerChild in tis way.

I would start by checking the exact versions of Apache and the modulse it has installed - it does have a more patchy track record than PHP in this regard (e.g.). Make sure your distro is up to date with all patches.

share|improve this answer
is there something I should add to make this more specific? what kind of information would you be looking for to recognize a problem? I don't see how closing this (or similar questions) would help anyone –  zack Mar 31 at 13:26

Your Answer


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.