wangmingda 回复于:2004-04-30 13:21:49 |
在Apache2.0中新加入了ServerLimit指令,使得无须重编译Apache就可以加大MaxClients。下面是笔者的prefork配置段。
<IfModule prefork.c> StartServers 10 MinSpareServers 10 MaxSpareServers 15 ServerLimit 2000 MaxClients 1500 MaxRequestsPerChild 10000 </IfModule> BTW: ServerLimit的最大值是20000,这对于大多数站点是足够了,但如果你一定要再加大的话,那么这个值位于源代码树下的server/mpm/prefork/prefork.c中。里面的 #define DEFAULT_SERVER_LIMIT 256 #define MAX_SERVER_LIMIT 20000 这两行就对应着MaxClients和ServerLimit的限制值。但我相信很少有人可以用到20000的并发连接数。 如果你有耐性看完了我这篇文档,我相信您对Apache2.0 缺省的prefork的工作原理有所熟悉了,理解了它的工作过程后,就可以根据您的实际情况在FreeBSD下来配置Apache相关的核心参数以获得最大的性能。 |
rickyfang 回复于:2004-04-30 14:58:23 |
无限感激中,原以为我已看懂了APACHE 2.0.48的说明文档,而且检查语法时,也出面ServerLimi 我竟没有耐心去找到它。唉。谢谢大哥!!!
BTW:按你的提示,我已搞定,解决了困惑很久的问题。 |
wangbin 回复于:2004-05-26 22:57:48 |
http://xcdx.enhand.net/viewthread.php?tid=3260 |
rickyfang 回复于:2004-05-27 21:49:42 |
谢过,只是我也有找到相关的网址呢,不错的说,让我对此有了更深的认识,而且我已成功的做成了。
想说,大家有时间的话,有些联系方式可以吗,组成共同的爱好者,为了我们的工作和爱好,努力一回吧! |
rickyfang 回复于:2004-05-30 16:34:55 |
有时想找几个志同道合者,可是,却没有人回应啊。QQ45723305 :( |
peng 回复于:2004-06-01 16:04:21 |
其实用apache2的话,./configure中应该用--with-mpm=worker参数,这样才能发挥apache2的多线程机制。
vi ~apache_install_path/conf/httpd.conf IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule> MaxClients x ThreadsPerChild =响应的请求数,可以根据自己的实际情况,更改threadsperchild数目。 对于linux下,其实不能实现多线程模式,要加大MaxClients 的数目,solaris下,就非常优秀了。。 wangmingda 说的也很正确,他是apache2编译的时候采用了默认的 --with-mpm=prefork模式,这种模式是兼容旧的软件版本的,不能更好的发挥apache2的线成特性。 本人对apache看的也很糙,希望和大家讨论。 |
rickyfang 回复于:2004-06-20 21:09:59 |
根据这位仁兄的说法,我做了两台服务器,一个是PREFORK的模式,一个是WORKER的工作模式,用MRTG做的流量监控,可能防问用户数量的问题,不是太明显,不过也感受了新的变化,谢过,请多交流吧? |
jackieyuan 回复于:2004-11-18 18:27:18 |
[quote:97d4083bdd="peng"]其实用apache2的话,./configure中应该用--with-mpm=worker参数,这样才能发挥apache2的多线程机制。
vi ~apache_install_path/conf/httpd.conf IfModule worker.c> StartServers 2 MaxClients ..........[/quote:97d4083bdd] [quote:97d4083bdd]Compile-Time Configuration Issues Choosing an MPM Apache 2.x supports pluggable concurrency models, called Multi-Processing Modules (MPMs). When building Apache, you must choose an MPM to use. There are platform-specific MPMs for some platforms: beos, mpm_netware, mpmt_os2, and mpm_winnt. For general Unix-type systems, there are several MPMs from which to choose. The choice of MPM can affect the speed and scalability of the httpd: The worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time. Worker generally is a good choice for high-traffic servers because it has a smaller memory footprint than the prefork MPM. The prefork MPM uses multiple child processes with one thread each. Each process handles one connection at a time. On many systems, prefork is comparable in speed to worker, but it uses more memory. Prefork's threadless design has advantages over worker in some situations: it can be used with non-thread-safe third-party modules, and it is easier to debug on platforms with poor thread debugging support. For more information on these and other MPMs, please see the MPM documentation.[/quote:97d4083bdd] http://httpd.apache.org/docs-2.0/misc/perf-tuning.html#compiletime :em02: :em02: |
jackieyuan 回复于:2004-11-18 23:30:02 |
[quote:25fcfbfbfb="peng"]其实用apache2的话,./configure中应该用--with-mpm=worker参数,这样才能发挥apache2的多线程机制。
vi ~apache_install_path/conf/httpd.conf IfModule worker.c> StartServers 2 MaxClients ..........[/quote:25fcfbfbfb] 因为在设置的时候出现错误,所以把我的想法说说看。 设置 [code:1:25fcfbfbfb]ServerLimit 8 StartServers 2 MinSpareThreads 15 MaxSpareThreads 25 ThreadsPerChild 25 MaxRequestsPerChild 1000 MaxClients 250[/code:1:25fcfbfbfb] 错误: [code:1:25fcfbfbfb]WARNING: MaxClients of 250 would require 10 servers, and would exceed the ServerLimit value of 8. Automatically lowering MaxClients to 200. To increase, please see the ServerLimit directive.[/code:1:25fcfbfbfb] 经过多次计算测试,我觉得应该是 [quote:25fcfbfbfb] [b:25fcfbfbfb][size=18:25fcfbfbfb]MaxClients <= ServerLimit * ThreadsPerChild[/size:25fcfbfbfb][/b:25fcfbfbfb][/quote:25fcfbfbfb] |