Using HTTP_ Load to do stress test for Linux server

Time:2021-2-23

Introduce a http_ Load stress testing tool, http_ Load, similar tools include webbench, AB and siege.
1. Download
Official website: http://acme.com/software/http_ load/

Copy code

The code is as follows:

cd /root
wget http://acme.com/software/http_load/http_load-12mar2006.tar.gz
tar xzf http_load-12mar2006.tar.gz

2. Installation

Copy code

The code is as follows:

cd http_load-12mar2006
make

After making, an HTTP will be generated in the current directory_ Load binary.
3. How to use it

Copy code

The code is as follows:

[email protected]:~/http_load-12mar2006# ./http_load –help
usage: ./http_load [-checksum] [-throttle] [-proxy host:port] [-verbose] [-timeout secs] [-sip sip_file]
-parallel N | -rate N [-jitter]
-fetches N | -seconds N
url_file

One start specifier, either -parallel or -rate, is required.
One end specifier, either -fetches or -seconds, is required.
Description of main parameters:
-Parallel – P: the number of concurrent user processes.
-Short for rate – R: it means the number of visits per second
-Fetches short for – F: means the total number of visits
-Seconds short for – s: it means the total access time
When selecting parameters, choose one of – parallel and – rate, and choose one of – fetches and – seconds.
Example:
http_load -parallel 50 -s 10 urls.txt
This command line uses 50 processes at the same time, random access urls.txt In the list of web addresses, a total of 10 seconds to visit.
http_load -rate 50 -f 5000 urls.txt
50 requests per second, a total of 5000 requests to stop.

4. Basic return value
(1).49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
It shows that 49 requests have been run in the above test, the maximum number of concurrent processes is 2, the total data transferred is 289884bytes, and the running time is 10.0148 seconds

(2).5916 mean bytes/connection
The average amount of data transmitted per connection is 289884 / 49 = 5916

(3).4.89274 fetches/sec, 28945.5 bytes/sec
The response request per second is 4.89274, and the data per second is 28945.5 bytes / sec

(4).msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
The average response time of each connection is 28.8932 MSECS, the maximum response time is 44.243 MSECS, and the minimum response time is 24.488 MSECS

(5).msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min

(6).HTTP response codes: code 200 — 49
Explain the type of open response page. If there are too many types of 403, you may need to pay attention to whether the system has encountered a bottleneck.
Special note: here, we generally focus on the indicators of fetches / sec and MSECS / connect
They correspond to the common performance index parameters QPT – the number of applications responding per second, the response time, and the user response time per connection. The test results mainly depend on these two values. Of course, only these two indicators can not complete the performance analysis, we also need to analyze the CPU and men of the server in order to draw a conclusion

5. If you need to test HTTPS, you have to put it in makefile

Copy code

The code is as follows:

# CONFIGURE: If you want to compile in support for https, uncomment these
# definitions. You will need to have already built OpenSSL, available at
# <a href=”http://www.openssl.org/”>http://www.openssl.org/</a> Make sure the SSL_TREE definition points to the
# tree with your OpenSSL installation – depending on how you installed it,
# it may be in /usr/local instead of /usr/local/ssl.
SSL_TREE = /usr
SSL_DEFS = -DUSE_SSL
SSL_INC = -I$(SSL_TREE)/include
SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto

Due to the use of OpenSSL, you must install OpenSSL and the corresponding development environment

Copy code

The code is as follows:

apt-get install openssl
apt-get install libssl-dev</p>
<p>find -name ssl.h
/usr/include/openssl/ssl.h

So the red part above has to be changed