Rumah >php教程 >php手册 >CloudFoundry php buildpack 性能调优

CloudFoundry php buildpack 性能调优

WBOY
WBOYasal
2016-06-06 19:58:401181semak imbas

采用了开源的cf-php-buildpack。 地址 https://github.com/dmikusa-pivotal/cf-php-build-pack 搭建内部apache 服务器后,将需要的依赖包放入apacher服务器,然后将buildpack中的option.json修改为搭建的apache服务器地址 问题1: 命令行 使用buildpack push

   采用了开源的cf-php-buildpack。 地址https://github.com/dmikusa-pivotal/cf-php-build-pack    搭建内部apache 服务器后,将需要的依赖包放入apacher服务器,然后将buildpack中的option.json修改为搭建的apache服务器地址

  

  问题1:  

  命令行 使用buildpack push 后,总是启动失败,查看crashlogs,发现fpm进程 没有启动

 Reading logs/stdout.log... OK
 06:51:32 php-fpm      | /bin/sh: /home/vcap/app/php/sbin/php-fpm: not found
06:51:32 php-fpm-logs | tail: cannot open `/home/vcap/app/../logs/php-fpm.log' for reading: No such file or directory

 使用 命令 cf files app/.bp/logs/bp.log  发现根本就没有下载 fpm 依赖包,最后定位出,是因为我的apache 服务器中没有 sha1  文件,增加后,恢复正常

 

问题2 :

      使用了wordpress 作为测试程序,push成功后,使用apache自带的ab进行测试,发现 10000个请求,500并发只能响应成功不到1000个。。。。。

      查看warden内 container 的日志 出现错误:

 [16-May-2014 07:14:45] WARNING: [pool www] pm.start_servers is not set. It's been set to 7.
[16-May-2014 07:14:45] NOTICE: fpm is running, pid 46
[16-May-2014 07:14:45] NOTICE: ready to handle connections
[16-May-2014 07:16:30] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 14 total children
[16-May-2014 07:16:31] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 19 total children
[16-May-2014 07:16:32] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 24 total children
[16-May-2014 07:16:33] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 29 total children
[16-May-2014 07:16:34] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

 

通过调整 buildpack中的php-fpm.conf 文件中的参数

pm.max_children = 30

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers =

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 10

 

最后测试,10000个请求,500并发,可以全部请求成功。

 

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn