linux+apache的最大进程

Apache允许为请求开的最大进程数是256,MaxClients的限制是256.如果用户多了,用户就只能看到Waiting for reply....然后等到下一个可用进程的出现。这个最大数,是Apache的程序决定的--它的NT版可以有1024,但Unix版只有256,你可以在src/include/httpd.h中看到:  

#ifndef HARD_SERVER_LIMIT  
#ifdef WIN32  
#define HARD_SERVER_LIMIT 1024  
#else  
#define HARD_SERVER_LIMIT 256  
#endif  
#endif  
你可以把它调到1024,然后再编译你的系统。记得在httpd.conf里也要更改相应配置,缺省好象是150。就下面的机器来说,调到512顶死了,如果再高,系统受不了。  

另外,一些系统也限制了一个用户的最大进程数。你可以用ulimit -u 来看。Linux一般是256。因此你要真想让Apache超过这个数,就得调整这个参数:  
ulimit -u unlimited  
这个参数要在Apache运行之前修改,因此建议加到apachectl里:  
case $ARG in  
start)  
if [ $RUNNING -eq 1 ]; then  
echo "$0 $ARG: httpd (pid $PID) already running"  
continue  
改成  
case $ARG in  
start)  
ulimit -u unlimited  
if [ $RUNNING -eq 1 ]; then  
echo "$0 $ARG: httpd (pid $PID) already running"  
continue你自己可以设置,想要多少就多少。
比如我使用的是DEBIAN+APACHE2,设置文件在/etc/apache2目录下:

#>;vi /etc/apache2/apache2.conf
找到下面的语句修改:

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.

MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.

KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##

# 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 serves
<IfModule prefork.c>;
StartServers          5
MinSpareServers       5
MaxSpareServers      10
MaxClients           20
MaxRequestsPerChild   0
</IfModule>;
具体想修改成多少看你自己的了。