Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a high load dynamic PHP web service which I have recently moved from Apache2 to Nginx and PHP-FPM. I am finding that the average request latency has increased from 0.5s to 1s since the move.

I'm not sure where the bottleneck in the system is, I had been hoping to decrease the average latency, I know that my machines are not:

  • limited by CPU
  • limited by memory capacity
  • limited by disk IO
  • limited by network IO

Nginx is forwarding the requests to PHP-FPM via a single unix socket.

  • Is it possible that the bottleneck is memory bandwidth?
  • Is there anyway to monitor the status of the unix socket?
  • Would it be better to have a pool of unix sockets and load balance between them?

Here's part of my nginx.conf file:

worker_processes 2; # one for each processor
worker_rlimit_nofile 65536;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;
fastcgi_max_temp_file_size 0;
proxy_buffer_size 32k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 32k;

and my php-fpm.conf

listen = /var/run/php5-fpm.sock
listen.backlog = 2048
pm = static
pm.max_children = 64

Does anything stand out as being outlandish or at fault?

share|improve this question
do you have APC enabled? enabling it decreases latency greatly – Andrei Mikhaltsov Jun 6 '13 at 13:42
What is APC? How can I enable it? I am using php5-xcache. – Pooky Jun 6 '13 at 15:03

Using a single socket should be fine.

A few things to check:

  1. What are the max number of filehandles per process? ulimit -n You may benefit from increasing this.

  2. Enable logging in php-fpm to see how long the requests are taking according it. In pool.d/www.conf:

    access.format = %R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%%

  3. Use the status module to see what's going on inside nginx :

share|improve this answer

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.