Apache ab concurrent load stress test implementation method

Apache ab concurrent load stress test implementation method

ab command principle

Apache's ab command simulates multi-threaded concurrent requests to test server load pressure. It can also test the pressure of other web servers such as nginx, lighthttp, and IIS.
The ab command has very low requirements for the computer issuing the load. It does not take up a lot of CPU or too much memory, but it will cause a huge load on the target server. Therefore, it is an essential remedy for certain DDOS attacks and is suitable for both young and old. Be careful when using it yourself. Otherwise, if too much load is applied at one time, the target server may crash due to running out of memory and have to be restarted, which is not worth the cost.

In the case of insufficient bandwidth, it is best to test locally. It is recommended to use another or multiple servers on the intranet to test through the intranet. The data obtained in this way will be much more accurate. Remotely stress testing a web server often does not produce satisfactory results (due to excessive network latency or insufficient bandwidth)

Download and install:
http://mirror.bit.edu.cn/apache//httpd/binaries/win32/?C=M;O=A

Find httpd-2.2.21-win32-x86-no_ssl.msi

Parameter documentation:
http://httpd.apache.org/docs/2.2/programs/ab.html

run:

In Windows system, open the cmd command line window and locate the bin directory of the apache installation directory
cd C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin

Type the command:

ab -n 800 -c 800 http://192.168.0.10/

(-n sends 800 requests, -c simulates 800 concurrency, which is equivalent to 800 people accessing at the same time, followed by the test URL)

ab -t 60 -c 100 http://192.168.0.10/
Send requests within 60 seconds, 100 requests at a time.

//If you need to include parameters in the url, do this
ab -t 60 -c 100 -T "text/plain" -p p.txt http://192.168.0.10/hello.html

p.txt is in the same directory as ab.exe
Parameters can be written in p.txt, such as p=wdp&fq=78

Result parameter explanation:
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.0.10 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Finished 800 requests


Server Software: Microsoft-HTTPAPI/2.0
Server Hostname: 192.168.0.10
Server Port: 80

Document Path: /
Document Length: 315 bytes The length of the HTTP response data body

Concurrency Level: 800
Time taken for tests: 0.914 seconds
Complete requests: 800 Completed requests: 800
Failed requests: 0
Write errors: 0
Non-2xx responses: 800
Total transferred: 393600 bytes
HTML transferred: 252000 bytes HTML content transferred
Requests per second: 875.22 [#/sec] (mean)
Time per request: 914.052 [ms] (mean) The time it takes for the server to receive the request and respond to the page
Time per request: 1.143 [ms] (mean, across all concurrent requests) Average time consumed by each concurrent request
Transfer rate: 420.52 [Kbytes/sec] received The average amount of network traffic per second. This can help to rule out whether there is excessive network traffic causing extended response time.


Breakdown of time spent on the network:
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 3
Processing: 245 534 125.2 570 682
Waiting: 11 386 189.1 409 669
Total: 246 535 125.0 571 684

The response status of all requests in the entire scenario. In the scenario each request has a response time where 50% of the users have a response time of less than 571 milliseconds
80% of users responded within 652 milliseconds. The maximum response time was less than 684 milliseconds.
Percentage of the requests served within a certain time (ms)
50% 571
66% 627
75% 646
80% 652
90% 666
95% 677
98% 681
99% 682
100% 684 (longest request)

You may also be interested in:
  • Use the Apache ab tool to perform a simple stress test on the Apache server
  • How to configure ab to do stress testing for Nginx server
  • ab website stress test command
  • Use ab tool to perform API stress test on the server

<<:  jQuery implements the drop-down box for selecting the place of residence

>>:  Analysis of the principle of using PDO to prevent SQL injection

Recommend

Vue el-date-picker dynamic limit time range case detailed explanation

There are two situations 1. Start time and end ti...

Writing tab effects with JS

This article example shares the specific code for...

How to solve the front-end cross-domain problem using Nginx proxy

Preface Nginx (pronounced "engine X") i...

Linux system prohibits remote login command of root account

ps: Here is how to disable remote login of root a...

Detailed explanation of the use of MySQL DML statements

Preface: In the previous article, we mainly intro...

Vue implements multi-column layout drag

This article shares the specific code of Vue to i...

How to quickly delete all tables in MySQL without deleting the database

This article uses an example to describe how to q...

Detailed analysis of Vue child components and parent components

Table of contents 1. Parent components and child ...

Detailed explanation of the use of default in MySQL

NULL and NOT NULL modifiers, DEFAULT modifier, AU...

Summary of common problems and solutions in Vue (recommended)

There are some issues that are not limited to Vue...

Detailed Linux installation tutorial

(Win7 system) VMware virtual machine installation...

Commonly used JavaScript array methods

Table of contents 1. filter() 2. forEach() 3. som...

Using MySQL database with Python 3.4 under Windows 7

The detailed process of using MySQL database with...

MySQL 8.0.17 installation graphic tutorial

This article shares with you the MySQL 8.0.17 ins...