This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10851|Reply: 3

windows Apache ab web site stress test

[Copy link]
Posted on 6/14/2018 11:14:30 AM | | | |
AB is an abbreviation for ApacheBench.

The ab command creates multiple concurrent access threads to simulate multiple visitors accessing a URL address at the same time. Its test targets are URL-based, so it can be used to test both apache load stress and other web server stresses such as nginx, lighthttp, tomcat, IIS, etc.

The ab command has low requirements for the computer that is issuing the load, and it does not take up a lot of CPU or memory. However, it will cause a huge load on the target server, and its principle is similar to CC attacks. You also need to pay attention to testing and using it yourself, otherwise you will have too much load at once. It may cause the target server to run out of resources, and in severe cases, even cause a crash.

1. Introduction to Apache Bench

ApacheBench is a web stress testing tool that comes with Apache servers, abbreviated as ab. ab is also a command-line tool with low native requirements for initiating payloads, and many concurrent access threads can be created according to the ab command, simulating multiple visitors accessing a certain URL address at the same time, so it can be used to test the load pressure of the target server. In general, the AB tool is small and simple, quick to learn and can provide the basic performance indicators you need, but there are no graphical results and cannot be monitored.



2. Apache Bench installation

First, you need to install the Apache server, download the address:The hyperlink login is visible.

My computer is a win10 64-bit system, so I downloaded "httpd-2.4.33-win64-VC15.zip", link:The hyperlink login is visible.

It is recommended to download the latest version, as older versions of ab do not support the -r parameter.

3. Apache Bench usage

Understand the parameters

Parameter description:
Format: ab [options] [http://]hostname[:p ort]/path

-n requests Number of requests to perform //The total number of requests initiated in this test
-c concurrency Number of multiple requests to make // Number of requests (or concurrency) generated at one time
-t timelimit Seconds to max. Wait for Responses //The maximum number of seconds a test is performed by default.
-r Don't exit on socket receive errors.     Throw an exception to continue the test task
-p postfile File containing data to POST // A file containing data that needs to be POST, in a file format such as "p1=1&p2=2". The method of use is -p 111.txt

-T content-type Content-type header for POSTing
The Content-type header used for the POST data, such as -T "application/x-www-form-urlencoded". (co-p)
-v verbosity How much troubleshooting info to print
Set the level of detail to display information – a value of 4 or greater will show header information, a value of 3 or greater will show a response code (404, 200, etc.), and a value of 2 or greater will show warnings and other information. -V displays the version number and exits.
-C attribute Add cookie, eg. -C “c1=1234,c2=2,c3=3” (repeatable)
-C cookie-name=value Append a cookie to the request: line. The typical form is a parameter pair of name=value. This parameter can be repeated, divided by a comma.
Tip: You can use the session implementation principle to pass the JSESSIONID parameter to achieve the function of maintaining the session, such as -C "c1=1234, c2=2, c3=3, JSESSIONID=FF056CD16DA9D71CB131C1D56F0319F8".
-w Print out results in HTML tables // Output results in HTML table format. By default, it is a table with two columns wide on a white background.
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-H attribute Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’ Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-h Display usage information (this message)

There are many parameters, generally we can use -c and -n parameters. For example:


Unzip the "httpd-2.4.33-win64-VC15.zip", go to \Apache24\bin, and start it with the cmd command line, as shown in the figure below:



SSL not compiled in; no https support: SSL is not compiled in; There is no https support, which means that the website does not support https.

Test results:

C:\Users\itsvse_pc\Downloads\httpd-2.4.33-win64-VC15\Apache24\bin>ab -c 10 -n 1000 https://www.itsvse.com
SSL not compiled in; no https support

C:\Users\itsvse_pc\Downloads\httpd-2.4.33-win64-VC15\Apache24\bin>ab -c 10 -n 1000 http://www.itsvse.com/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,The hyperlink login is visible.
Licensed to The Apache Software Foundation,The hyperlink login is visible.

Benchmarkingwww.itsvse.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 Hostname:        www.itsvse.com
Server Port:            80

Document Path:          /
Document Length:        178 bytes

Concurrency Level:      10
Time taken for tests:   44.916 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      349000 bytes
HTML transferred:       178000 bytes
Requests per second:    22.26 [#/sec] (mean)
Time per request:       449.164 [ms] (mean)
Time per request:       44.916 [ms] (mean, across all concurrent requests)
Transfer rate:          7.59 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       32   45  60.1     37    1439
Processing:    35  401 185.6    356    1795
Waiting:       34  245 199.6    228    1791
Total:         69  446 195.4    397    1830

Percentage of the requests served within a certain time (ms)
  50%    397
  66%    415
  75%    439
  80%    461
  90%    535
  95%    623
  98%   1563
  99%   1784
100%   1830 (longest request)

Parameter analysis:

Document Path: Test page
Document Length: The page size
Concurrency Level: The number of concurrency tested concurrently
Time taken for tests: The duration of the entire test
Complete requests: The number of requests completed
Failed requests: The number of failed requests
Write errors: 0
Total transferred: The amount of network transferred throughout the process
HTML transferred: The amount of HTML content transferred throughout the process
Requests per second: One of the most important metrics, equivalent to transactions per second in LR, and mean in parentheses indicates that this is an average
Time per request: The two most important metrics, equivalent to the average transaction response time in LR, mean in parentheses indicates that this is an average
Time per request: The average of the actual run time for each connection request
Transfer rate: Average traffic per second on the network, which can help rule out the problem of excessive network traffic causing long response times





Previous:Use lambda expressions in Linq to Entity to implement Left Join and Join
Next:asp.net mvc Route route mapping .html suffix
 Landlord| Posted on 6/14/2018 11:16:33 AM |
 Landlord| Posted on 5/27/2019 9:17:09 AM |
ab -n 800 -c 800  The hyperlink login is visible.
-nissued800requests,-cSimulation800Concurrency, equivalent to 800 people visiting at the same time, followed by the test url)
 Landlord| Posted on 5/27/2019 9:20:46 AM |
You can also perform a stress concurrency test through Fiddler, open the Fiddler tool, and block all requests, as shown in the figure below:


Select the session you want to repeat requested, and then pressshift+r, will pop up Repeat this request how many times? (How many times do you repeat this request?) )

Enter the number of times you want to repeat the request, here I filled in 5, fiddle will help you repeat the link 5 times, as shown in the figure below:



For more tips on how to operate fiddle, please refer to the manual:

Fiddler Chinese manual .zip download
https://down.itsvse.com/item/12839.html


Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com