Use Apache's own ab to measure pressure

The usage of ab is: ab [options] [http://]hostname[:port]/path

E.g:

ab -n 5000 -c 200 http://localhost/index.php

The above example indicates that the script http://localhost/index.php is accessed 5000 times in total, and 200 concurrent executions are executed simultaneously.

Introduction of ab common parameters:

-n: The total number of request executions, the default is 1;

-c: Concurrent number, the default is 1;

-t: the total time of the test, in seconds, the default is 50000s

-p: data file at POST

-w: output results in HTML table format

ab performance index

In the process of performance testing, several indicators are more important:

1. Throughput rate (Requests per second)

A quantitative description of the concurrent processing capacity of a server, the unit is reqs/s, which refers to the number of requests processed per unit time under a certain number of concurrent users. The maximum number of requests that can be processed per unit time for a certain number of concurrent users is called the maximum throughput rate.

Remember: the throughput rate is based on the number of concurrent users. This sentence represents two meanings:

a. Throughput rate is related to the number of concurrent users

b. Under different numbers of concurrent users, throughput rates are generally different

Calculation formula: the total number of requests/the time it takes to process these requests, that is

Request per second=Complete requests/Time taken for tests

It must be noted that this value represents the overall performance of the current machine, the larger the value, the better.

2. The number of concurrent connections

The number of concurrent connections refers to the number of requests accepted by the server at a certain time. Simply put, it is a session.

3. Number of concurrent users (Concurrency Level)

Pay attention to the difference between this concept and the number of concurrent connections. A user may have multiple sessions at the same time, that is, the number of connections. Under HTTP/1.1, IE7 supports two concurrent connections, IE8 supports 6 concurrent connections, and FireFox3 supports 4 concurrent connections, so correspondingly, our number of concurrent users has to be divided by this base.

4. Average user request waiting time (Time per request)

Calculation formula: the time it takes to process all the requests/(total requests/concurrent users), namely:

Time per request=Time taken for tests/(Complete requests/Concurrency Level)

5. Server average request waiting time (Time per request: across all concurrent requests)

Calculation formula: the time taken to process all the requests/total number of requests, namely:

Time taken for/testsComplete requests

As you can see, it is the inverse of the throughput rate.

At the same time, it is also equal to the average user request waiting time/the number of concurrent users, namely

Time per request/Concurrency Level

Guess you like

Origin blog.csdn.net/qq_43737121/article/details/113546955
Recommended