php fpm performance tuning config

Most important features

  1. php slow log and timeout  – kill too long request to make place for other request
    1. make sure that you will check this file log
  2. max_request and process_idle_timeout – allow to reduce memory after peak
cat /etc/php5/fpm/pool.d/www.conf 
[www]
user = dev
group = dev
listen = 127.0.0.1:9000
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5000
pm.process_idle_timeout = 30s
pm.start_servers = 200
pm.min_spare_servers = 200
pm.max_spare_servers = 500
pm.max_requests = 1000
request_terminate_timeout = 60
slowlog = /var/log/php5slow.log
request_slowlog_timeout = 30s
chdir = /