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

Possible Duplicate:
100% CPU when doing 4 or more concurrent requests with Magento

people. This is my first question, but this community has been helpful to me hundreds of times, so thank you very much.

Now to my issue. I know similar questions have been posted multiple times, but I am still unable to solve the issue after some hours on Google and in shell.

This is on a web server running Ubuntu 12.04 with Magento installed and low traffic (~70K page views per week).

Server specs:

  • Ubuntu 12.04
  • 1 core
  • 2 GB RAM

Software versions

  • Nginx: 1.1.19
  • PHP5-FPM: 5.3.10-1ubuntu3.4 (fpm-fcgi)
  • MySQL: 5.5.28-0ubuntu0.12.04.2
  • APC: 3.1.7
  • Memcached: 1.4.13

As far as I can tell, APC and Memcached is working perfectly.

THE FOLLOWING OUTPUT IS GENERATED WHEN SERVER IS HANDLING 10 - ten - USERS (basically nothing)


top

top - 14:07:41 up 12 days,  3:45,  1 user,  load average: 1.37, 1.43, 1.48
Tasks:  90 total,   6 running,  84 sleeping,   0 stopped,   0 zombie
Cpu(s): 61.3%us,  6.0%sy,  0.0%ni, 30.3%id,  0.0%wa,  0.0%hi,  2.3%si,  0.0%st
Mem:   2051736k total,  1628388k used,   423348k free,   114516k buffers
Swap:  1998844k total,        0k used,  1998844k free,   370760k cached

vmstat 5

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 6  0      0 433952 114672 371120    0    0     9    34    3   10 34  4 62  0
 0  0      0 434896 114680 371136    0    0     0    16  477  293 23  4 73  0
 0  0      0 434664 114688 371168    0    0     0    17  560  379 36  5 58  0
 5  0      0 424900 114696 371172    0    0     0    24  473  310 38  5 57  0
 0  0      0 434340 114700 371196    0    0     0    12  379  281 21  3 77  0
 1  0      0 429844 114712 371220    0    0     0    11  887  647 68  9 23  0
 5  0      0 420048 114720 371224    0    0     0    43  528  361 41  5 54  0
 0  0      0 435812 114720 371248    0    0     0     5  451  397 38  4 58  0

iotop: Hardly any read / write traffic

PHP-FPM status:

pool:                 www
process manager:      static
start time:           29/Nov/2012:12:59:42 +0100
start since:          4572
accepted conn:        4157
listen queue:         0
max listen queue:     1
listen queue len:     128
idle processes:       19
active processes:     1
total processes:      20
max active processes: 9
max children reached: 0

Nginx Status:

Active connections: 13 
server accepts handled requests
 5781 5781 27611 
Reading: 0 Writing: 1 Waiting: 12 

Relevant PHP-FPM pool configuration


/etc/php5/fpm/pool.d/www.conf:

pm = static
pm.max_children = 20
pm.max_requests = 50

Total PHP Memory usage: 1.18 GB
Total Nginx memory usage: 151 MB


I am totally stumped as to why load is high and server is sluggish. Any input would be greatly appreciated. Even as to finding out excactly what is queueing up on my server to create this load.

EDITS:


Top when idle:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                   
    1 root      20   0 24292 1944 1004 S  0.0  0.1   0:06.14 init                                                                                                                      
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.03 kthreadd                                                                                                                  
    3 root      20   0     0    0    0 S  0.0  0.0   1:27.71 ksoftirqd/0                                                                                                               
    5 root      20   0     0    0    0 S  0.0  0.0   0:00.27 kworker/u:0                                                                                                               
    6 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                                                                               
    7 root      RT   0     0    0    0 S  0.0  0.0   0:07.77 watchdog/0  

Sudden bursts of php5-fpm in top:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                   
17533 www-data  20   0  786m  52m  25m R 19.8  2.6   0:11.21 php5-fpm                                                                                                                  
17534 www-data  20   0  786m  56m  30m R 19.8  2.8   0:10.58 php5-fpm                                                                                                                  
17539 www-data  20   0  786m  56m  30m R 19.8  2.8   0:09.49 php5-fpm                                                                                                                  
17544 www-data  20   0  786m  56m  30m R 19.8  2.8   0:09.98 php5-fpm                                                                                                                  
17671 www-data  20   0  786m  60m  34m R 19.8  3.0   0:08.10 php5-fpm                                                                                                                  
    1 root      20   0 24292 1944 1004 S  0.0  0.1   0:06.14 init    
share|improve this question

marked as duplicate by Michael Hampton, Scott Pack, rnxrx, voretaq7 Dec 1 '12 at 14:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What processes are at the top of the top list? –  Marius Gedminas Nov 29 '12 at 13:49
    
Thank you for responding, @MariusGedminas. I've edited in some more top output. –  Simen Nov 29 '12 at 14:44

1 Answer 1

Have you checked with htop, which process is ramping cpu? Also pm.max_requests = 50 seems too low (is Magento leaking?). I would go with pm.max_requests = 500 .

share|improve this answer
1  
Thank you for the suggestions. There is nothing ramping up the CPU in top (other than some php5-fpm processes which briefly do some work). Average CPU load is ~20% I have also played around with pm.max_requests, but it does not really make a difference. The server rarely hits the 50 requests limit and have thus had at most 9 php processes active. –  Simen Nov 29 '12 at 14:12
1  
Please vote that this question is not a duplicate. Details: My CPU load is not high at all. The proposed duplicate question clearly says that "all four cores run at 100%...". I wish for that user to get his issue resolved, but it is not a duplicate of mine and probably has a different solution. I do not have high CPU load, and that is excactly the point of the question: How does one find out what is causing load when CPU, RAM and IO operations are all low? Please vote to re-open this question. Thanks a lot. –  Simen Dec 2 '12 at 19:53

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