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);

1.尽量少安装PHP模块,最简单是最好(快)的

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就可以

注:我的1g测试机,开64个是最好的,建议使用压力测试获取最佳值

3. Using SOCKET PHP FastCGI, and put into /dev/shm on Linux;

3.使用socket连接FastCGI,linux操作系统可以放在 /dev/shm中

注: 在php-fpm.cnf 里设置/tmp/

nginx

.socket就可以通过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

4.调高linux内核打开文件数量,可以使用这些命令(必须是root帐号)

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 “1024”

Change 1024 to 4096 or higher number.

Restart PHP-FPM.

5. 增加 PHP-FPM 打开文件描述符的限制:

# vi /path/to/php-fpm.conf

找到“1024”

把1024 更改为 4096 或者更高.

重启 PHP-FPM.

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

最新文章

  1. 第二十二篇:在SOUI中使用代码向窗口中插入子窗口
  2. React-native之持久化保存----AsyncStorage
  3. 利用Redis解决Url过长的问题
  4. Windows Server 2003搭建邮件服务器
  5. SPOJ 227 Ordering the Soldiers 线段树 / 树状数组
  6. LA 4636 (贪心) Cubist Artwok
  7. MIT 2012分布式课程基础源码解析一-源码概述
  8. Bzoj 1036: [ZJOI2008]树的统计Count 树链剖分,LCT
  9. 获取sap登陆用户名的中文描述
  10. 使用bat脚本永久激活Windows系统(摘抄)
  11. Nginx详解二十二:Nginx深度学习篇之Lua解释器安装及基础语法
  12. 每天一个linux命令:chown
  13. 最短路(Bellman)-Hdu1874畅通工程序
  14. vs2015打开慢的解决方法
  15. AFNetWorking上传JSON串
  16. JDK并发包中ExecutorCompletionService使用
  17. day76
  18. golang学习笔记 --switch
  19. idea tomcat启动乱码问题
  20. jQuery ajax 当async为false时解决同步操作失败的问题

热门文章

  1. LCD驱动程序架构和分析
  2. UVa 839 Not so Mobile (递归思想处理树)
  3. java web项目的https配置
  4. centos下安装java jdk1.8
  5. Hadoop 权限管理(转)
  6. Android Studio遇到了“No USB devices or running emulators detected”
  7. linux教程及常用命令手册
  8. mysql常用内置函数-查询语句中不能使用strtotime()函数!
  9. cs224d 作业 problem set1 (二) 简单的情感分析
  10. git和svn的比较