How to implement web stress testing through Apache Bench

How to implement web stress testing through Apache Bench

1. Introduction to Apache Bench

ApacheBench is a web stress testing tool that comes with the Apache server, referred to as ab. ab is also a command line tool that has very low requirements for the local machine that initiates the load. According to the ab command, many concurrent access threads can be created to simulate multiple visitors accessing a certain URL address at the same time. Therefore, it can be used to test the load pressure of the target server. In general, the ab tool is small and simple, easy to learn, and can provide the basic performance indicators you need, but it does not have graphical results and cannot be monitored.

2. Apache Bench Installation

First, you need to install the Apache server. Download address: https://www.apachelounge.com/download/. For a 64-bit operating system, select one of the compressed packages above.

Install

Ubuntu

1: Use apt to install online: sudo apt install apache2-utils

2: Check whether the installation is successful: ab -V

Common parameter description

Test report interpretation

example

(1) Simulate 100 client requests:

ab -n 100 http://www.example.com/

(2) Simulate 100 client requests 10,000 times:

ab -n 10000 -c 100 http://www.example.com/

(3) Call the POST method interface 10 times, and the data format transmitted is JSON:

ab -n 10 -p json-file http://www.example.com/

(4) Call the OPTIONS method interface 10 times:

ab -n 10 -m OPTIONS http://www.example.com/

(5) Output the response information for each request:

ab -n 10 -v 2 http://www.example.com/

Precautions

  • Using -H Content-Type does not replace -T Content-Type to specify the Content-Type header
  • If the message ab: invalid URL appears, it may be because the rightmost part of the URL is missing /. For example, http://www.example.com needs to be changed to http://www.example.com/.
  • It should be noted that if the HTTP interface of the stress test determines whether it is successful by returning the result (as long as it can respond, it will return a 200 status code), you need to find a way to identify failed requests yourself.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Apache Bench stress testing tool implementation principle and usage analysis
  • Apache ab concurrent load stress test implementation method
  • Use the Apache ab tool to perform a simple stress test on the Apache server
  • Summary of common knowledge about Apache stress testing and web performance optimization
  • Apache ab tool page stress test return results interpretation
  • Installation and use of Apache stress testing tools

<<:  Native JS to achieve special effects message box

>>:  MySQL database account creation, authorization, data export and import operation examples

Recommend

vue-router hook function implements routing guard

Table of contents Overview Global hook function R...

Install multiple versions of PHP for Nginx on Linux

When we install and configure the server LNPM env...

Issues with upgrading Python and installing Mongodb drivers under Centos

Check the Python version python -V If it is below...

Summary of changes in the use of axios in vue3 study notes

Table of contents 1. Basic use of axio 2. How to ...

vue perfectly realizes el-table column width adaptation

Table of contents background Technical Solution S...

Two ways to install the Linux subsystem in Windows 10 (with pictures and text)

Windows 10 now supports Linux subsystem, saying g...

Detailed explanation of Javascript closures and applications

Table of contents Preface 1. What is a closure? 1...

Detailed explanation of overflow:auto usage

Before starting the main text, I will introduce s...

How to use Typescript to encapsulate local storage

Table of contents Preface Local storage usage sce...

Why MySQL database avoids NULL as much as possible

Many tables in MySQL contain columns that can be ...

Sharing of the fast recovery solution for Mysql large SQL files

Preface In the process of using MySQL database, i...

Linux uses shell scripts to regularly delete historical log files

1. Tools directory file structure [root@www tools...