怎么优化设置apache的并发数量
2016-05-29 00:00
387 查看
如何设置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 -l
说明:看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 -l
说明:看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 POI
- Mac OSX 搭建 Apache php mySql phpMyAdmin 开发环境
- CentOS系统如何设置APACHE和MYSQL服务开机自动运行
- Apache服务器 配置多个网站解决方案
- mac 系统升级到 OS X EI Capitan Apache 配置
- Class org.apache.struts2.json.JSONWriter can not access a member of
- SVN版本管理系统的安装 CentOS + Subversion + Apache + Jsvnadmin
- Maven:程序包org.apache.log4j不存在问题处理
- linux 安装apache 错误:configure: error: /bin/sh build/config.sub failed解决办法
- Apache:BeanUtils和PropertyUtils的区别
- Apache Curator入门实战
- Apache服务器配置
- Apache jar包总结
- Apache服务器最新版下载、安装及配置(win版
- PHP + APACHE 智能安装(别整那些没用的了)
- ubuntu下配置apache多端口网站
- Apache提示You don't have permission to access / on this server问题解决
- Apache中如何设置默认首页具体该怎么操作
- 微信开发之SVN提交代码与FTP同步到apache的根目录