华域联盟 Linux 使ApacheBench支持multi-url的方法

使ApacheBench支持multi-url的方法

使ApacheBench支持multi-url的方法

 更新时间:2021年01月04日 10:10:04   作者:wangqingyong  
这篇文章主要介绍了使ApacheBench支持multi-url的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

由于标准的ab只支持对单个uri进行压测,不满足实际需要,故做以下修改,使ab支持multi-url。

1、下载Apache httpd相关源码包以及针对ab工具的patch包

wget mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
wget mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.37.tar.gz
wget 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内容请搜索华域联盟以前的文章或继续浏览下面的相关文章希望大家以后多多支持华域联盟!

相关文章

  • Linux基本网络配置方法介绍

    Linux基本网络配置方法介绍

    本篇文章主要介绍了Linux网络基本网络配置方法介绍,对于初学linux有一定的帮助,有需要的朋友可以了解一下。

    2016-12-12

  • Linux下编译安装python3步骤

    Linux下编译安装python3步骤

    本篇文章主要介绍了Linux下编译安装python3,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    2017-01-01

  • Linux系统下使用U盘的方法

    Linux系统下使用U盘的方法

    在linux系统之中, 一切设备皆文件, 所以我们的U盘也是一个文件.磁盘设备被抽象成sda文件, U盘设备被抽象成sdb文件。这篇文章主要介绍了Linux系统下使用U盘的方法,需要的朋友可以参考下

    2016-10-10

  • Linux下rz/sz安装及使用方法示例

    Linux下rz/sz安装及使用方法示例

    这篇文章主要介绍了Linux下rz/sz安装及使用方法示例,详细的介绍了如何使用和安装rz/sz,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

    2018-06-06

  • Ubuntu16.04搭建NFS 文件共享服务器的方法

    Ubuntu16.04搭建NFS 文件共享服务器的方法

    这篇文章主要介绍了Ubuntu16.04搭建NFS 文件共享服务器的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    2018-04-04

  • CentOS6.6详细安装教程(图文教程)

    CentOS6.6详细安装教程(图文教程)

    这篇文章主要介绍了CentOS6.6详细安装教程(图文教程),对初学者有一定的参考价值,有需要的可以了解一下。

    2016-10-10

  • Linux下源码编译安装配置SVN服务器的步骤分享

    Linux下源码编译安装配置SVN服务器的步骤分享

    这篇文章主要介绍了Linux下源码编译安装配置SVN服务器,需要的朋友可以参考下

    2015-07-07

  • Linux 为特定的用户或用户组启用或禁用 SSH的方法

    Linux 为特定的用户或用户组启用或禁用 SSH的方法

    这篇文章主要介绍了如何在 Linux 上为特定的用户或用户组启用或禁用 SSH,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

    2020-03-03

  • Linux下指定源ip进行ping操作的方法

    Linux下指定源ip进行ping操作的方法

    今天小编就为大家分享一篇Linux下指定源ip进行ping操作的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

    2018-06-06

  • 在Linux中查看所有正在运行的进程的方法

    在Linux中查看所有正在运行的进程的方法

    这篇文章主要介绍了在Linux中查看所有正在运行的进程的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    2020-07-07

最新评论

本文由 华域联盟 原创撰写:华域联盟 » 使ApacheBench支持multi-url的方法

转载请保留出处和原文链接:https://www.cnhackhy.com/3390.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

上一篇
使ApacheBench支持multi-url的方法

已经没有了

Linux实现驱动模块传参过程解析

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们