使ApacheBench支持multi-url的方法
由于標(biāo)準(zhǔn)的ab只支持對(duì)單個(gè)uri進(jìn)行壓測(cè),不滿(mǎn)足實(shí)際需要,故做以下修改,使ab支持multi-url。
1、下載Apache httpd相關(guān)源碼包以及針對(duì)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依賴(lài)于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、驗(yàn)證結(jié)果
#/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已經(jīng)支持-L參數(shù)(上面幫助信息的倒數(shù)第3行),大功告成。
到此這篇關(guān)于使ApacheBench支持multi-url的方法的文章就介紹到這了,更多相關(guān)ApacheBench支持multi-url內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用apachetop實(shí)時(shí)監(jiān)控日志、動(dòng)態(tài)分析服務(wù)器運(yùn)行狀態(tài)
這篇文章主要介紹了使用apachetop實(shí)時(shí)監(jiān)控日志、動(dòng)態(tài)分析服務(wù)器運(yùn)行狀態(tài),通過(guò)apachetop這個(gè)工具可以動(dòng)態(tài)的查看apache的日志文件,還可以直觀的看到訪(fǎng)問(wèn)的每個(gè)地址的請(qǐng)求數(shù)、速度及流量等信息,需要的朋友可以參考下2014-06-06CentOs 7.3中搭建RabbitMQ 3.6單機(jī)多實(shí)例服務(wù)的步驟與使用
這篇文章主要給大家介紹了關(guān)于CentOs 7.3中搭建RabbitMQ 3.6單機(jī)多實(shí)例服務(wù)的步驟與使用的相關(guān)資料,文中將實(shí)現(xiàn)的方法介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友下面來(lái)一起看看吧。2018-03-03Linux CentOS 定時(shí)運(yùn)行腳本配置的方法
今天小編就為大家分享一篇Linux CentOS 定時(shí)運(yùn)行腳本配置的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-06-06Apache 服務(wù)器最新版下載、安裝及配置教程圖解(Windows版)
本文通過(guò)圖文并茂的形式給大家介紹了Apache 服務(wù)器最新版下載、安裝及配置教程(Windows版),需要的朋友可以參考下2017-12-12淺析Linux中vsftpd服務(wù)配置(匿名,用戶(hù),虛擬用戶(hù))
vsftpd 是一個(gè) UNIX 類(lèi)操作系統(tǒng)上運(yùn)行的服務(wù)器的名字,支持很多其他的 FTP 服務(wù)器所不支持的特征。這篇文章主要介紹了Linux中vsftpd服務(wù)配置(匿名,用戶(hù),虛擬用戶(hù)),需要的朋友可以參考下2019-11-11Ubuntu14.04 opencv2.4.8和opencv3.3.1多版本共存的實(shí)現(xiàn)方法
下面小編就為大家分享一篇Ubuntu14.04 opencv2.4.8和opencv3.3.1多版本共存的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2017-12-12