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.

Recently I've uploaded some changes to my server that increases the amount of AJAX calls made to the server.

The application "fastness" has decreased a lot. The web server is nginx with php5-fpm module

If I run a "top" command on the server console I see:

  • Between 5 and 8 php5-fpm processes that takes about 70-80% of CPU usage

The configurations are: (just the significative part)

/etc/nginx/nginx.conf

worker_processes  8;

events{
    worker_connections  1024;
    multi_accept off;
}

http{
    sendfile        on;
    keepalive_timeout  30;
    tcp_nodelay        off;
    client_max_body_size 64m;
    gzip  on;
}

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

pm = dynamic
pm.max_children = 10
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.process_idle_timeout = 5s;
pm.max_requests = 400

The Server specs:

  • 24Gb of RAM
  • Inter Xeon 8 Cores

What do you think about this problem? Is it caused by a server configuration not optimal? What configuration do you suggest for this server?

share|improve this question
    
It is really impossible to know without seeing the said scripts that are hitting PHP. Are you hitting CPU or memory limits? You said it is using 70-80%, what was it before? Is it slowness in PHP or in the network latency on the ajax scripts? –  Dave Drager Nov 19 '12 at 22:13

1 Answer 1

With 24 GB of RAM you should increase these settings

pm.max_children
pm.start_servers
pm.min_spare_servers
pm.max_spare_servers

to something more sane for your server. Your current settings are in a sort of "nice at home to play with" setting.

For example, see "Tuning PHP5-FPM" here and do the math. My guess would be to start out by multiplying the numbers by 10 or so.

Anyway, your PHP application could still be linear CPU-bound instead of worker-bound and tuning would not help a thing.

share|improve this answer
    
Thanks! Worked like a charm! –  boblith Nov 21 '12 at 20:39
    
@boblith Glad to hear that. Please consider accepting the answer. –  gertvdijk Nov 21 '12 at 21:19

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.