How to make ApacheBench support multi-url

How to make ApacheBench support multi-url

Since the standard ab only supports stress testing on a single URI, which does not meet actual needs, the following modifications are made to enable ab to support multi-URL.

1. Download the Apache httpd related source code package and the patch package for the ab tool

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

Note: httpd depends on apr and apr-util

2. Compile and install apr

tar -zxf apr-1.6.5.tar.gz
cd apr-1.6.5
./configure --prefix=/usr/local/apr
make && make install

3. Compile and install 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. Replace the ab.c file in the httpd source code

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. Compile and install 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. Verify the results

#/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)

You can see that ab already supports the -L parameter (the third line from the bottom of the help information above), and you are done.

This is the end of this article about how to make ApacheBench support multi-url. For more information about ApacheBench supporting multi-url, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Apache Bench stress testing tool implementation principle and usage analysis
  • How to implement web stress testing through Apache Bench
  • How to install apachebench separately in CentOS environment

<<:  React implements multi-component value transfer function through conetxt

>>:  HTML Form Tag Tutorial (4):

Recommend

Example of using Dockerfile to build an nginx image

Introduction to Dockerfile Docker can automatical...

Solution to the cross-domain problem of SpringBoot and Vue interaction

Table of contents Browser Same Origin Policy 1. V...

A brief discussion on the solution to excessive data in ElementUI el-select

Table of contents 1. Scenario Description 2. Solu...

Native js implements a minesweeper game with custom difficulty

This article example shares the specific code of ...

A brief analysis of MySQL locks and transactions

MySQL itself was developed based on the file syst...

How to use @media in mobile adaptive styles

General mobile phone style: @media all and (orien...

React implements a highly adaptive virtual list

Table of contents Before transformation: After tr...

Summary of MySQL common SQL statements including complex SQL queries

1. Complex SQL queries 1.1. Single table query (1...

Summary of @ usage in CSS (with examples and explanations)

An at-rule is a declaration that provides instruc...

How to configure MySQL on Ubuntu 16.04 server and enable remote connection

background I am learning nodejs recently, and I r...

Some findings and thoughts about iframe

This story starts with an unexpected discovery tod...

Summary of Node.js service Docker container application practice

This article will not explain the use and install...

jQuery implements form validation

Use jQuery to implement form validation, for your...