li
  当前位置:主页 > 基础知识 > 文章内容
li
apache下限制并发数、IP、带宽的方法(2)
来源: www.ixdba.net  作者: IXDBA.NET官方    时间:2008-07-01   阅读:24  
本文章共3230字,分2页,当前第2页,快速翻页:
 

  < /IfModule >
  < /VirtualHost >

----------------------------------------------------------------------------------------------

限制带宽:

下载模块ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c
安装:
/usr/local/apache/bin/apxs -c ./mod_bandwidth.c -o /usr/local/apache/libexec/mod_bandwidth.so 

<-------以上/usr/local/apache请设置为你的路径

编辑httpd.conf
添加:
LoadModule bandwidth_module libexec/mod_bandwidth.so
AddModule mod_bandwidth.c

重启你的apache

相关文档:

Global configuration directives :

    * BandWidthDataDir
      Syntax : BandWidthDataDir <directory>
      Default : "/tmp/apachebw"
      Context : server config

Sets the name of the root directory usedby mod_bandwidth to store its internal temporary information. Don't forget to create the needed directories : <directory>/master and <directory>/link

    * BandWidthModule
      Syntax : BandWidthModule <On|Off>
      Default : Off
      Context : per server config

Enable or disable totaly the whole module. By default, the module is disable so it is safe to compile it in the server anyway.

PLEASE, NOTE THAT IF YOU SET A BANDWIDTH LIMIT INSIDE A VIRTUALHOST BLOCK, YOU ALSO __NEED__ TO PUT THE "BandWidthModule On" DIRECTIVE INSIDE THAT VIRTUALHOST BLOCK !

IF YOU SET BANDWIDTH LIMITS INSIDE DIRECTORY BLOCKS (OUTSIDE OF ANY VIRTUALHOST BLOCK), YOU ONLY NEED TO PUT THE "BandWidthModule On" DIRECTIVE ONCE, OUTSIDE OF ANY VIRTUALHOST OR DIRECTORY BLOCK.

    * BandWidthPulse
      Syntax : BandWidthPulse <microseconds>
      Default :
      Context : per server config

Change the algorithm used to calculate bandwidth and transmit data. In normal mode (old mode), the module try to transmit data in packets of 1KB. That mean that if the bandwidth available is of 512B, the module will transmit 1KB, wait 2 seconds, transmit another 1KB and so one.

Seting a value with "BandWidthPulse", will change the algorithm so that the server will always wait the same amount of time between sending packets but the size of the packets will change. The value is in microseconds. For example, if you set "BandWidthPulse 1000000" (1 sec) and the bandwidth available is of 512B, the sever will transmit 512B, wait 1 second, transmit 512B and so on.

The advantage is a smother flow of data. The disadvantage is a bigger overhead of data transmited for packet header. Setting too small a value (bellow 1/5 of a sec) is not realy useful and will put more load on the system and generate more traffic for packet header.

www.ixdba.net


Note also that the operating system may do some buffering on it's own and so defeat the purpose of setting small values.

This may be very useful on especialy crowded network connection : In normal mode, several seconds may happen between the sending of a full packet. This may lead to timeout or people may believe that the connection is hanging. Seting a value of 1000000 (1 sec) would guarantee that some data are sent every seconds...



阅读更多内容<<上一页 · 1 · 2


  上一篇: 高性能的 HTTP 和 反向代理 服务...   下一篇: 高性能http服务器Nginx,超牛的we...
li
 §相关评论  
 热点文章

·RewriteRule重写规则的语法:A
·apache配置文件httpd.conf参数
·Apache的配置文件http.conf参数
·HTTP协议中POST、GET、HEAD等参
·XAMPP命令之LAMPP
·Linux中安装XAMPP(LAMPP)服务器
·网页禁止右键、禁止复制等代码
·java.lang.OutOfMemoryError:
·Mysql数据库在Linux系统常用命
·mysql问答:MySQL数据库连接过多
·MySQL数据库中Show命令的用法
li
 编辑推荐
·RewriteRule重写规则的语法:A
·apache配置文件httpd.conf参数
·Apache的配置文件http.conf参数
·HTTP协议中POST、GET、HEAD等参
·XAMPP命令之LAMPP
·Linux中安装XAMPP(LAMPP)服务器
·网页禁止右键、禁止复制等代码
·java.lang.OutOfMemoryError:
·Mysql数据库在Linux系统常用命
·mysql问答:MySQL数据库连接过多
·MySQL数据库中Show命令的用法
li
 相关篇章
·高性能的 HTTP 和 反向代理 服务...
·无法打开网站网页,但是QQ可以登录...
·IBM DB2 9数据库恢复原理介绍
·MySQL数据库的基本使用指南
·利用linux rpm方式安装Mysql
·mysql数据库源码安装详解
·MySQL导入导出工具mysqlimport用...
·MySQL数据库中Show命令的用法
·mysql问答:MySQL数据库连接过多的...
·Mysql数据库在Linux系统常用命令...
·高性能http服务器Nginx,超牛的we...
·Nginx完全教程(必读)
·原创Nginx环境的搭建(支持正则)
·Nginx轻量级的HTTP服务器-理论篇
·Lighttpd+Squid+Apache搭建高效率...
·隐藏Apache,PHP版本和相关基本安...
·Apache Url Rewrite(mod_rewrite...
·apache中并发控制参数prefork理解...
·Apache2的httpd.conf经典翻译
·nginx的防盗链配置
 
li
设为首页 | 关于我们 | 技术服务 | 收藏本站 | 网站地图 | 联系方式 | 本站友情连接