如何设置apache的并发数量
2015-12-24 16:00
866 查看
如何设置apache的并发数量
1、在httpd.conf文件中修改
#Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
将上面一句的#注释去掉
2、确定当前的apache是什么MPM模式(winnt模式,perfork模式,worker模式)
进入到apache/bin目录
cmd命令:httpd.exe -1
说明:看mpm_xxx.c 如果xxx是winnt 说明是winnt,另外还可能是perfork或者worker
3、修改httpd-mpm.conf文件
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150 //修改这个值即可
MaxRequestsPerChild 0
</IfModule>
4、重启apache,测试看看
在Linux下,一般采用的MPM是perfork模式
<IfModule mpm_prefork_module>
StartServers 5 //预先起5个进程
MinSpareServers 5 //最小空闲进程
MaxSpareServers 10 //最大空闲进程
MaxClients 150 //并发连接数
MaxRequestsPerChild 0 //指一个进程里可以起多少个线程,对worker更好,0为不限制
</IfModule>
给大家一个合理的建议配置,对在部分网站,中型网站,配置:
<IfModule mpm_prefork_module>
StartServers 5 //预先起5个进程
MinSpareServers 5 //最小空闲进程
MaxSpareServers 10 //最大空闲进程
ServerLimit 1500 // 用于修改apache编程参数
MaxClients 1000 //并发连接数
MaxRequestsPerChild 0 //指一个进程里可以起多少个线程,对worker更好,0为不限制
</IfModule>
如果你的网站pv值百万,可以这样设置:
ServerLimit 2500 // 用于修改apache编程参数
MaxClients 2000 //并发连接数
1、在httpd.conf文件中修改
#Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
将上面一句的#注释去掉
2、确定当前的apache是什么MPM模式(winnt模式,perfork模式,worker模式)
进入到apache/bin目录
cmd命令:httpd.exe -1
说明:看mpm_xxx.c 如果xxx是winnt 说明是winnt,另外还可能是perfork或者worker
3、修改httpd-mpm.conf文件
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150 //修改这个值即可
MaxRequestsPerChild 0
</IfModule>
4、重启apache,测试看看
在Linux下,一般采用的MPM是perfork模式
<IfModule mpm_prefork_module>
StartServers 5 //预先起5个进程
MinSpareServers 5 //最小空闲进程
MaxSpareServers 10 //最大空闲进程
MaxClients 150 //并发连接数
MaxRequestsPerChild 0 //指一个进程里可以起多少个线程,对worker更好,0为不限制
</IfModule>
给大家一个合理的建议配置,对在部分网站,中型网站,配置:
<IfModule mpm_prefork_module>
StartServers 5 //预先起5个进程
MinSpareServers 5 //最小空闲进程
MaxSpareServers 10 //最大空闲进程
ServerLimit 1500 // 用于修改apache编程参数
MaxClients 1000 //并发连接数
MaxRequestsPerChild 0 //指一个进程里可以起多少个线程,对worker更好,0为不限制
</IfModule>
如果你的网站pv值百万,可以这样设置:
ServerLimit 2500 // 用于修改apache编程参数
MaxClients 2000 //并发连接数
相关文章推荐
- apache日志分析
- 让人郁闷的Apache ServerLimit
- Apache流量猛增,并发过高导致问题的处理解决方案
- Apache优化:修改最大并发连接数
- yii2 urlManager url美化及apache下yii2 rewrite设置
- 在Mac OS上自行编译安装Apache服务器和PHP解释器
- apache中MaxClients和ServerLimit参数介绍
- 优化Apache,提高并发
- 学习使用apache comments io包中的IOUtils中的方法
- 在Mac OS上使用mod_wsgi连接Python与Apache服务器
- Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected
- Apache Storm 翻译简介
- Apache负载均衡配置文件
- 【php】win2003虚拟机中apache服务器的访问
- Linux+Apache+SVN搭建SVN服务器(CentOS)
- 解决Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4
- window下为apache配置ssl证书
- 在Mac OS上自行编译安装Apache服务器和PHP解释器
- 在Mac OS上使用mod_wsgi连接Python与Apache服务器
- 在Linux系统上部署Apache+Python+Django+MySQL环境