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

3 ways to correctly modify the maximum number of connections in MySQL

We all know that after the MySQL database is inst...

Summary of the three stages of visual designer growth

Many people have read this book: "Grow as a ...

Sample code for implementing markdown automatic numbering with pure CSS

The origin of the problem The first time I paid a...

CSS to implement sprites and font icons

Sprites: In the past, each image resource was an ...

Mysql database scheduled backup script sharing

BackUpMysql.sh script #!/bin/bash PATH=/bin:/sbin...

How to obtain root permissions in a docker container

First, your container must be running You can vie...

jQuery implements accordion small case

This article shares the specific code of jQuery t...

JS function call, apply and bind super detailed method

Table of contents JS function call, apply and bin...

Vue3 slot usage summary

Table of contents 1. Introduction to v-slot 2. An...

Summary of various common join table query examples in MySQL

This article uses examples to describe various co...

Several ways to center a box in Web development

1. Record several methods of centering the box: 1...

mySql SQL query operation on statistical quantity

I won't say much nonsense, let's just loo...