PHP-FPM高负载技巧
来源:互联网 发布:户口本复印件制作软件 编辑:程序博客网 时间:2024/05/17 23:56
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
- PHP-FPM高负载技巧
- 高负载PHP-FPM调优
- 高负载PHP-FPM调优
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载的解决办法
- PHP-FPM高负载下的优化配置
- PHP-FPM 高负载后停止响应 502
- Nginx+PHP-FPM优化技巧
- Nginx+PHP-FPM优化技巧
- 高负载PHP调优
- nginx-php-fpm 高并发配置优化
- 【原创】Nginx+PHP-FPM优化技巧总结
- Nginx+PHP-FPM的优化技巧(2)
- 如何设置/删除/查询wince环境变量
- 支持多个浮动层而不冲突的漂浮广告(兼容性不错)
- Java笔试题【转】
- 430日志
- Android自动化测试初探(三): 架构实现
- PHP-FPM高负载技巧
- HTC XV6900 蓝牙立体声听歌问题的解决
- 简单Struts2实例(入门级)
- 64位Windows下跑32应用程序
- 文档格式批量转换(doc,txt,pdf等)
- .net 开发使用office组件后,IIS中部署出现无法访问的解决办法
- VirtualBox DHCP 网络问题简单的排查方法
- 获取.net的根目录的方法 和 Server.MapPath
- 构建运行时映像