Introduction to Web server performance testing tool

Posted by Shovinus on Thu, 28 Oct 2021 06:57:38 +0200

web performance testing tool

Related tools: Web bench, Apache bench

Stress test related indicators

  • Throughput (Requests per second, RPS): the number of requests processed per unit time under a certain number of concurrent users.

    Note: RPS is based on the number of concurrent users. R P S = C o m p l e t e   r e q u e s t s / T i m e   t a k e n   f o r   t e s t s RPS = Complete\ requests / Time\ taken\ for\ tests RPS=Complete requests/Time taken for tests

  • The number of concurrent connections refers to the number of requests accepted by the server at a certain time.

  • The number of concurrent users, Concurrency Level

    Note: different from the number of concurrent connections, a user may generate multiple sessions at the same time, that is, the number of connections.

  • Average user request waiting time (Time per request) T i m e   p e r   r e q u e s t = T i m e   t a k e n   f o r   t e s t s / ( C o m p l e t e   r e q u e s t s / C o n c u r r e n c y   L e v e l ) Time \ per\ request = Time\ taken\ for\ tests / (Complete\ requests / Concurrency\ Level) Time per request=Time taken for tests/(Complete requests/Concurrency Level)


The standard test of webch can show us two contents of the server: the number of corresponding requests per second and the amount of data transmitted per second. Webbench can not only test quasi-static pages, but also test dynamic pages (ASP,PHP,JAVA,CGI). In addition, it supports static or dynamic performance testing of secure websites containing SSL, such as e-commerce websites. Webbench can simulate up to 30000 concurrent connections to test the load capacity of the website.

  • webbench installation

    tar zxvf webbench-1.5.tar.gz
    cd webbench-1.5
    make install
  • webbench use

    webbench -c 1000 -t 60 URL
    webbench -c Concurrent number -t Run test time URL
  • Command line options:

    Short ginsengLong parametereffect
    -f–forceThere is no need to wait for the server to respond
    -r–reloadSend reload request
    -t–timeHow long does it run, in seconds“
    -p–proxy server:portUse a proxy server to send requests
    -c–clientsHow many clients are created? 1 by default“
    -9–http09Use HTTP/0.9
    -1–http10Use HTTP/1.0 protocol
    -2–http11Use HTTP/1.1 protocol
    –getUsing the GET request method
    –headUsing the HEAD request method
    –optionsUsing the OPTIONS request method
    –traceUsing TRACE request method
    -?/-h–helpprint the help information
    -V–versionDisplay version number

Apache bench

The ab command will create many concurrent access threads to simulate multiple visitors accessing a URL address at the same time.

  • Command line options:

    Options are:
        -n requests     Number of requests to perform
        -c concurrency  Number of multiple requests to make at a time
        -t timelimit    Seconds to max. to spend on benchmarking
                        This implies -n 50000
        -s timeout      Seconds to max. wait for each response
                        Default is 30 seconds
        -b windowsize   Size of TCP send/receive buffer, in bytes
        -B address      Address to bind to when making outgoing connections
        -p postfile     File containing data to POST. Remember also to set -T
        -u putfile      File containing data to PUT. Remember also to set -T
        -T content-type Content-type header to use for POST/PUT data, eg.
                        Default is 'text/plain'
        -v verbosity    How much troubleshooting info to print
        -w              Print out results in HTML tables
        -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
        -C attribute    Add cookie, eg. 'Apache=1234'. (repeatable)
        -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.
        -q              Do not show progress when doing more than 150 requests
        -l              Accept variable document length (use this for dynamic pages)
        -g filename     Output collected data to gnuplot format file.
        -e filename     Output CSV file with percentages served
        -r              Don't exit on socket receive errors.
        -m method       Method name
        -h              Display usage information (this message)

Test your web server

ab -n 10000 -c 100 URL

Test 10000 requests, 100 concurrent cases, corresponding server configuration, 6G memory + 4-core CPU under VBOX, run the test program locally, and the test results are as follows

Server Software:
Server Hostname:        ****
Server Port:            ****

Document Path:          /
Document Length:        1131 bytes

Concurrency Level:      100
Time taken for tests:   119.681 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      11890000 bytes
HTML transferred:       11310000 bytes
Requests per second:    83.56 [#/sec] (mean)
Time per request:       1196.808 [ms] (mean)
Time per request:       11.968 [ms] (mean, across all concurrent requests)
Transfer rate:          97.02 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   11  97.6      1    1015
Processing:     6 1176 1295.6    546    7227
Waiting:        1  814 1063.4    212    5327
Total:          7 1187 1303.6   1101    7228

Percentage of the requests served within a certain time (ms)
  50%   1101
  66%   1263
  75%   1489
  80%   2234
  90%   3223
  95%   4226
  98%   5260
  99%   5336
 100%   7228 (longest request)

You can see that the longest response time of the request is 7.2s, the failed requests is 0, and the RPS is 83.56