由于标准的ab只支持对单个uri进行压测,不满足实际需要,故做以下修改,使ab支持multi-url。
1、下载Apache httpd相关源码包以及针对ab工具的patch包
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.37.tar.gz wget https://github.com/philipgloyne/apachebench-for-multi-url/archive/master.zip
注:httpd依赖于apr和apr-util
2、编译安装apr
tar -zxf apr-1.6.5.tar.gz cd apr-1.6.5 ./configure --prefix=/usr/local/apr make && make install
3、编译安装apr-util
tar -zxf apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install
4、替换httpd源码里面的ab.c文件
unzip master.zip tar -zxf httpd-2.4.37.tar.gz \cp ./apachebench-for-multi-url-master/ab.c ./httpd-2.4.37/support/
5、编译安装httpd
cd httpd-2.4.37 ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-mpm=prefork --enable-modules=most --enable-mpms-shared=all make && make install
6、验证结果
#/usr/local/apache/bin/ab -h Usage: /usr/local/apache/bin/ab [options] [http[s]://]hostname[:port]/path Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make -t timelimit Seconds to max. wait for responses -b windowsize Size of TCP send/receive buffer, in bytes -p postfile File containing data to POST. Remember also to set -T -u putfile File containing data to PUT. Remember also to set -T -T content-type Content-type header for POSTing, eg. 'application/x-www-form-urlencoded' Default is 'text/plain' -v verbosity How much troubleshooting info to print -w Print out results in HTML tables -i Use HEAD instead of GET -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -r Don't exit on socket receive errors. -h Display usage information (this message) -L Use URL list file name, eg. url.txt -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
可以看到ab已经支持-L参数(上面帮助信息的倒数第3行),大功告成。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com
暂无“使ApacheBench支持multi-url的方法”评论...
更新日志
2024年05月15日
2024年05月15日
- 群星《勇气家族 电视剧原声带》[320K/MP3]16.67MB]
- 哈迪斯2黑帝斯银白之颅图鉴及附魔效果一览 哈迪斯银白之颅操作介绍及祝福推荐
- 黑帝斯哈迪斯2全武器图鉴及附魔效果一览 全武器操作介绍及祝福推荐
- dnf龙袍套装属性与天空套对比
- 横山菁儿-三国志-燃烧的长江-1993-APE整轨
- [ABC唱片]-《李传韵-琴魂》[K2-018][K2CD]WAV+CUE
- 【ABC唱片】《黃河號子SACD-011》-WAV分轨
- 当《生化危机2:重制版》加入路径追踪:画面真实感显著提升!
- 《哈迪斯2》BOSS不让暂停惹恼玩家:我手柄没电了!
- 《美末》S2艾莉造型首曝:头发留长 成熟了不少
- 邰正宵.2024-重燃爱恋.贰Walk.On【福茂】【FLAC分轨】
- 叶凡.2007-相思【中唱】【WAV+CUE】
- 王永.1997-十二道金牌【鸿心工作室】【WAV+CUE】
- dnf110换装在哪刷
- dnf110新版buff换装在哪里做