使ApacheBench支持multi-url的方法
由于标准的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行),大功告成。
到此这篇关于使ApacheBench支持multi-url的方法的文章就介绍到这了,更多相关ApacheBench支持multi-url内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
CentOs 7.3中搭建RabbitMQ 3.6单机多实例服务的步骤与使用
这篇文章主要给大家介绍了关于CentOs 7.3中搭建RabbitMQ 3.6单机多实例服务的步骤与使用的相关资料,文中将实现的方法介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友下面来一起看看吧。2018-03-03Apache 服务器最新版下载、安装及配置教程图解(Windows版)
本文通过图文并茂的形式给大家介绍了Apache 服务器最新版下载、安装及配置教程(Windows版),需要的朋友可以参考下2017-12-12浅析Linux中vsftpd服务配置(匿名,用户,虚拟用户)
vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,支持很多其他的 FTP 服务器所不支持的特征。这篇文章主要介绍了Linux中vsftpd服务配置(匿名,用户,虚拟用户),需要的朋友可以参考下2019-11-11Ubuntu14.04 opencv2.4.8和opencv3.3.1多版本共存的实现方法
下面小编就为大家分享一篇Ubuntu14.04 opencv2.4.8和opencv3.3.1多版本共存的实现方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2017-12-12
最新评论