php 參數優化

一、修改php參數
 
1、修改php啓動的配置文件
vi /usr/local/webserver/php/etc/php-fpm.conf
 
php5.2.x
 
max_children
修改爲200對應4G
修改爲300對應8G
 
php5.3.x
 
ps:如果pm=static
 
     pm.max_children:靜態方式下開啓的php-fpm進程數量。
 
ps:如果pm=dynamic
 
     pm.start_servers:動態方式下的起始php-fpm進程數量
     pm.min_spare_servers:動態方式下的最小php-fpm進程數量
     pm.max_spare_servers:動態方式下的最大php-fpm進程數量
 
 
2、rlimit_files
修改爲65535
 
 
二、修改系統參數
 
1、系統參數
 
vi /etc/sysctl.conf
 
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog =  32768
net.core.somaxconn = 32768
 
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
 
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
 
net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
 
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
#
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024  65535
#
vm.overcommit_memory = 1
 
 
2、調高linux內核打開文件數量
 
1)環境變量調整
echo 'ulimit -HSn 65535' >> /etc/profile
echo 'ulimit -HSn 65535' >> /etc/rc.local
 
source /etc/profile
 
2)、limits.conf調整
vi  /etc/security/limits.conf
 
*        soft    nofile  65535
*        hard    nofile  65535
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章