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

How to use time as a judgment condition in MySQL

Background: During the development process, we of...

Centos7 installation of Nginx integrated Lua sample code

Preface The computer I use is a Mac, and the oper...

Solution for Docker container not recognizing fonts such as Songti

Problem background: When using docker to deploy t...

How to set up swap partition SWAP in Linux 7.7

The Swap partition of the Linux system, that is, ...

Steps to install MySQL 5.7 in binary mode and optimize the system under Linux

This article mainly introduces the installation/st...

How to connect XShell and network configuration in CentOS7

1. Linux network configuration Before configuring...

Data storage implementation method in WeChat applet

Table of contents Global variable globalData Page...

Use Python to connect to MySQL database using the pymysql module

Install pymysql pip install pymysql 2|0Using pymy...

A brief discussion on the mysql execution process and sequence

Table of contents 1:mysql execution process 1.1: ...

Implementation of mysql configuration SSL certificate login

Table of contents Preface 1. MySQL enables SSL co...

HTML meta explained

Introduction The meta tag is an auxiliary tag in ...

WeChat Mini Program Basic Tutorial: Use of Echart

Preface Let’s take a look at the final effect fir...