Website stress testing tool -ab Tools

1. Pressure test related concepts:

 Throughput (Requests per second)

Concepts: concurrent processing server capabilities described quantization unit is reqs / s, refers to the number of requests processed per unit time at a certain number of concurrent users. The maximum number of requests at a certain number of concurrent users that can be processed per unit of time, called maximum throughput.
Calculated: Total number of requests / the number of requests processed time spent, i.e.,
Request per second = Complete requests / Time taken for tests

The number of concurrent connections (The number of concurrent connections)
concept: the number of requests received by the server at some point, simply speaking, is a conversation. 

Concurrent (The number of concurrent users, Concurrency Level) user

Concept: important to distinguish the difference between the concept and the number of concurrent connections, a user may simultaneously generate multiple sessions, i.e. the number of connections.

 Average user request waiting time (Time per request)

Calculated: number of requests processed all the time spent / (total number of requests / number of concurrent users), i.e.,
Time per request = Time taken for tests / (Complete requests / Concurrency Level)

 Average server request waiting time (Time per request: across all concurrent requests)

Calculated: number of requests processed all the time spent / total number of requests, i.e.
Time taken for / testsComplete requests
can see that it is the inverse of throughput.
It also mean = user request waiting time / number of concurrent users, i.e.,
Time per request / Concurrency Level

 2.ab tool Description:

ab is an abbreviation of apache bench, it is Apache's own stress testing tool, mainly for site access web server stress test.

3. INSTALLATION:
[root @ localhost yum.repos.d] # yum -y install httpd-Tools
is loaded plugins: langpacks
is addressing dependencies
-> Checking affairs
---> Packages httpd-tools.x86_64. 0.2.4.6-88.el7.ns7.01 will be installed
-> complete dependency resolution

Resolve dependencies

================================================== ================================================== ==========
Package Penalty for architecture version of the source size
=================================== ================================================== =========================
being installed:
the httpd-Tools 90 K the x86_64 2.4.6-88.el7.ns7.01 Nk7.6

Transaction Summary
================================================ ================================================== ============
installation 1 package

Total downloads: 90 k
Installation Size: 169 K
Downloading Packages:
Running Transaction Check
Running Transaction Test
the Transaction Test succeeded.
Running Transaction
Installing: httpd-tools-2.4.6-88.el7.ns7.01.x86_64 1/1
Verification : httpd-tools-2.4.6-88.el7.ns7.01.x86_64 1/1

Has been installed:
httpd-tools.x86_64 0: 2.4.6-88.el7.ns7.01

Finished!

# View the version information ab
[root @ localhost yum.repos.d] # ab -V
This IS ApacheBench, Version 2.3 <$ Revision: 1.4303 million $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net /
Licensed to the Apache Software Foundation at The, http://www.apache.org/

4.用法:
ab [options] [http[s]://]hostname[:port]/path

# Some options Description
-k enable KeepAlive function, perform multiple requests in a single session
-r as much as possible to send a request
-n number of access requests
-c concurrent

#示例:
[root@localhost yum.repos.d]# ab -kr -n 1000 -c 100 https://www.cnblogs.com/zhangyanjiang
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.cnblogs.com (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
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software: # Server Software
Server Hostname: www.cnblogs.com # domain name server
Server Port: 443 # server port
SSL / TLS Protocol: TLSv1.2, ECDHE -RSA-AES128-GCM-SHA256,2048,128

Document Path: / zhangyanjiang # to access the file path
Document Length: 3902 bytes

Concurrency Level: 100 # concurrent access, -c parameter value corresponding to
Time taken for tests: 13.180 seconds # Total Access Time Test
Complete requests: 1000 # Total access number, as the parameter value corresponding -n
Failed requests: 0 # number of failed access to
the Write errors: 0
the Keep-Alive requests: 0
the Total Transferred: 4.04 million bytes
the HTML Transferred: 3.902 million bytes
requests per SECOND: 75.87 [# / sec] (Mean) # number of access requests processed per second, often referred to throughput is the
time per request: 1318.043 [ms] (mean) # average user request waiting time
time per request: 13.180 [ms] (mean, across all concurrent requests) # server average request waiting time
Transfer rate: 299.33 [Kbytes / sec ] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 220 839 2188.1 267 9309
Processing: 78 102 17.0 98 210
Waiting: 77 98 15.1 95 193
Total: 301 941 2187.5 367 9416

Percentage of the requests served within a certain time (ms)
50% 367
66% 384
75% 397
80% 404
90% 443
95% 9332
98% 9369
99% 9390
100% 9416 (longest request)

Guess you like

Origin www.cnblogs.com/zhangyanjiang/p/12081274.html