由于标准的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的更多相关文章

  1. Apache下开启SSI配置使html支持include包含

    写页面的同学通常会遇到这样的烦恼,就是页面上的 html 标签越来越多的时候,寻找指定的部分就会很困难,那么能不能像 javascript 一样写在不同的文件中引入呢?答案是有的,apache 能做到 ...

  2. Qone 正式开源,使 javascript 支持 .NET LINQ

    Qone 下一代 Web 查询语言,使 javascript 支持 LINQ Github: https://github.com/dntzhang/qone 缘由 最近刚好修改了腾讯文档 Excel ...

  3. 修改sqlarchemy源码使其支持jdbc连接mysql

    注意:本文不会将所有完整源码贴出,只是将具体的思路以及部分源码贴出,需要感兴趣的读者自己实验然后实现吆. 缘起 公司最近的项目需要将之前的部分业务的数据库连接方式改为jdbc,但由于之前的项目都使用s ...

  4. 记一次在mac上源码编译curl,使其支持NSS的过程

    一.背景 在一次学习https原理的过程中,希望客户端指定特定的cipher suites来抓包分析SSL/TLS的握手过程,就想到了使用curl工具,而不是使用浏览器. 接下来使用man curl找 ...

  5. AFNETWorking 不支持中文URL请求

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; min-height: 16.0px } p.p ...

  6. Linux下安装libiconv使php支持iconv函数

    libiconv组件安装好了可以让我们php支持iconv函数了,这个函数的作用就是字符编码强制转换了,下面和111cn小编一起来看一个Linux中安装libiconv使php支持iconv函数的例子 ...

  7. 2.移植3.4内核-使内核支持烧写yaffs2

    在上章-制作文件系统,并使内核成功启动jffs2文件系统了 本章便开始使内核支持烧写yaffs2文件系统 1.首先获取yaffs2源码(参考git命令使用详解) cd /work/nfs_root g ...

  8. Atom 编辑器安装 linter-eslint 插件,并配置使其支持 vue 文件中的 js 格式校验

    安装方式有如下几种. 1.最常用的安装方式. # 进入atom插件文件夹 cd ~/.atom/packages/ # git clone 插件源文件 git clone https://github ...

  9. 使HTML5支持RTSP流 微信直播RTSP流 微信播放RTSP直播流(HTML5播放rtsp,web播放rtsp,微信支持rtsp)

    一.大家都知道HTML5的VIDEO可以播放视频,但是H5不支持RTSP播放,所以需要中间件! 二.我们经理长年的努力,开发了HTML5支持RTSP的中间件,使HTML5支持RTSP直播! 三.不卡顿 ...

随机推荐

  1. [CSP-S模拟测试]:数列(数学)

    题目传送门(内部题95) 输入格式 第一行三个整数$n,a,b$,第二行$n$个整数$x_1\sim x_n$表示数列. 输出格式 一行一个整数表示答案.无解输出$-1$. 样例 样例输入:2 2 3 ...

  2. Access to the requested object is only available from the local network phpmyadmin

    http://stackoverflow.com/questions/11999371/access-to-the-requested-object-is-only-available-from-th ...

  3. MySort的实现

    代码: package week12; import java.util.*; import java.lang.Integer; public class MySort{ public static ...

  4. modern php笔记---2.1、特性(命名空间、特性、性状)

    modern php笔记---2.1.特性(命名空间.特性.性状) 一.总结 一句话总结: legend2是真的非常好用,资质起码提升5倍,也就是学习效率提升了起码5倍 1.命名空间实质? 从技术层面 ...

  5. 微信小程序 API 路由

    路由:由于页面的跳转: wx.switchTab() 跳转到 tabBar 页面,并关闭掉其他所有非 tabBar 页面: 参数:为对象, 对象的属性: url:需要跳转的 tabBar 的页面路径( ...

  6. 测试版和正式版微信小程序共享存储空间问题

    一般习惯将变量存储在小程序的storage缓存中,然后用到的时候再去取.但是有一次我在做小程序相关内容的时候发现,对于苹果手机,测试版本小程序和正式版本小程序的缓存变量是相互通用的.

  7. hibernate 配置+注释

    Hibernate配置属性 属性名 用途 hibernate.dialect 一个Hibernate Dialect类名允许Hibernate针对特定的关系数据库生成优化的SQL. 取值 full.c ...

  8. IDEA使用设置

    IDEA版本为2017.2.1 1.设置主题 File->Settings->Appearance,界面如下 2.修改快捷键-Eclipse方式 File->Settings-> ...

  9. 2.nginx配置详细说明

    Nginx配置详解 nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行 ...

  10. 【Linux开发】【Qt开发】嵌入式Qt程序使用触屏或USB鼠标方式

    上文<嵌入式Qt开发-移植到ARM开发板 >介绍了Qt程序的移植,本文再说下如何使开发板Qt程序使用触摸屏或USB方式进行交互. 之前刚把一个qt程序移植到arm板上成功运行显示时就开心的 ...