----------------apache SetEnv
SetEnv HOME "/usr/local/home"
SetEnv PHP_ENV "DEV"
---php
$home = getenv('HOME');
switch(getenv('PHP_ENV'))
{
case 'RLS':
require 'config_release.inc.php';
break;
case 'TEST':
require 'config_test.inc.php';
break;
case 'DEV':
require 'config_dev.inc.php';
break;
}
-----------[Apache] 查看Apache并发请求数及其TCP连接状态[转]
引用
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process servesStartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 2000
MaxClients 2000
MaxRequestsPerChild 10000
查看httpd进程数(即prefork模式下Apache能够处理的并发请求数):
Linux命令:
引用
ps -ef | grep httpd | wc -l
返回结果示例:
1388
表示Apache能够处理1388个并发请求,这个值Apache可根据负载情况自动调整,我这组服务器中每台的峰值曾达到过2002。
查看Apache的并发请求数及其TCP连接状态:
Linux命令:
引用
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
(这条语句是从新浪互动社区事业部 新浪互动社区事业部技术总监王老大那儿获得的,非常不错)
返回结果示例:
LAST_ACK 5
SYN_RECV 30
ESTABLISHED 1597
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057
其中的SYN_RECV表示正在等待处理的请求数;ESTABLISHED表示正常数据传输状态;TIME_WAIT表示处理完毕,等待超时结束的请求数。