<value name="max_children">5</value>

        Settings group for 'apache-like' pm style
        <value name="apache_like">

          Sets the number of server processes created on startup.
          Used only when 'apache-like' pm_style is selected
          <value name="StartServers">20</value>

          Sets the desired minimum number of idle server processes.
          Used only when 'apache-like' pm_style is selected
          <value name="MinSpareServers">5</value>

          Sets the desired maximum number of idle server processes.
          Used only when 'apache-like' pm_style is selected
          <value name="MaxSpareServers">35</value>  

<value name="rlimit_files">65535</value>

<value name="max_requests">1024</value>

When you running a highload website with PHP-FPM via FastCGI, the following tips may be useful to you : )
如果您高负载网站使用PHP-FPM管理FastCGI,这些技巧也许对您有 用:)

1. Compile PHP’s modules as less as possible, the simple the best (fast);

2. Increas PHP FastCGI child number to 100 and even more. Sometime, 200 is OK! ( On 4GB memory server);
2.把您的PHP FastCGI子进程数调到100或以上,在4G内存的服务器上200就可以

3. Using SOCKET PHP FastCGI, and put into /dev/shm on Linux;
3.使用socket连接FastCGI,linux操作系统可以放在 /dev/shm中
注:在php-fpm.cnf里设置<value name=”listen_address”>/tmp/nginx.socket</value>就可以通过socket连接 FastCGI了,/dev/shm是内存文件系统,放在内存中肯定会快了

4. Increase Linux “max open files”, using the following command (must be root):
# echo ‘ulimit -HSn 65536′ >> /etc/profile
# echo ‘ulimit -HSn 65536 >> /etc/rc.local
# source /etc/profile

echo ‘ulimit -HSn 65536’ >> /etc/profile
echo ‘ulimit -HSn 65536’ >> /etc/rc.local
source /etc/profile

注:我是修改/etc/rc.local,加入ulimit -SHn 51200的

5. Increase PHP-FPM open file description rlimit:
# vi /path/to/php-fpm.conf
Find “<value name=”rlimit_files”>1024</value>”
Change 1024 to 4096 or higher number.
Restart PHP-FPM.

5. 增加 PHP-FPM 打开文件描述符的限制:
# vi /path/to/php-fpm.conf
找到“<value name=”rlimit_files”>1024</value>”
把1024 更改为 4096 或者更高.

6. Using PHP code accelerator, e.g eAccelerator, XCache. And set “cache_dir” to /dev/shm on Linux.
6.使用php代码加速器,例如 eAccelerator, XCache.在linux平台上可以把`cache_dir`指向 /dev/shm



44 thoughts on “nginx下关于PHP-FPM在高负载下的优化配置

  1. Pingback: Mājas lapas hostings

  2. Pingback: huong dan dang ky w88

  3. Pingback: เงินกู้ ขอนแก่น

  4. Pingback: find out here now

  5. Pingback: Discover More Here

  6. Pingback: from Bhojpuri film

  7. Pingback: Creative Agency in Orlando

  8. Pingback: 우리카지노

  9. Pingback: ดาวรุ่งที่น่าจับตามอง

  10. Pingback: ww88 com

  11. Pingback:

  12. Pingback: oral Blowjob Blonde

  13. Pingback: Nachfolger

  14. Pingback: blog

  15. Pingback: forum

  16. Pingback: 인터넷바카라

  17. Pingback: cdrqq

  18. Pingback: cheap flight booking

  19. Pingback: Togel OnLine

  20. Pingback:

  21. Pingback: trang m88

  22. Pingback: cross borders all weather

  23. Pingback: 카지노

  24. Pingback: 안전놀이터

  25. Pingback: Büyük sivas haber

  26. Pingback: 카지노사이트

  27. Pingback:

  28. Pingback: Library

  29. Pingback: 온라인카지노

  30. Pingback: satta king

  31. Pingback: 카지노사이트

  32. Pingback: 토토사이트

  33. Pingback: 안전바카라

  34. Pingback: Pussy888 malaysia and singapore

  35. Pingback: Islam

  36. Pingback: sbobet

  37. Pingback: KIU

  38. Pingback: mahi mahi fish

  39. Pingback: kasim ayi

  40. Pingback: taxi service

  41. Pingback: Jelle Hoffenaar

  42. Pingback: 먹튀검증-51

  43. Pingback: kalpa pharma store

  44. Pingback: keto review

Comments are closed.