Linux-web性能测试工具

Jmeter
Apache Bench


#Apache Bench
#dnf install httpd -y
#Apache 自带的测试工具
➜  ~ ab
ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
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.
                    'application/x-www-form-urlencoded'
                    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)
    -I              Disable TLS Server Name Indication (SNI) extension
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol
                    (SSL2, SSL3, TLS1, TLS1.1, TLS1.2 or ALL)

#访问10万次 每秒1000次
➜  ~ ab -n 100000 -c 1000 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests


Server Software:        Apache/2.4.29
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /
Document Length:        4650 bytes

Concurrency Level:      1000
Time taken for tests:   8.741 seconds
Complete requests:      100000
Failed requests:        0
Non-2xx responses:      100000
Total transferred:      492200000 bytes
HTML transferred:       465000000 bytes
Requests per second:    11440.30 [#/sec] (mean)
Time per request:       87.410 [ms] (mean)
Time per request:       0.087 [ms] (mean, across all concurrent requests)
Transfer rate:          54989.43 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   32  94.2     26    3125
Processing:     5   53 104.9     38    2377
Waiting:        5   45 104.7     30    2368
Total:          7   85 140.8     65    3162

Percentage of the requests served within a certain time (ms)
  50%     65
  66%     69
  75%     71
  80%     72
  90%     77
  95%    255
  98%    278
  99%    925
 100%   3162 (longest request)




dnf install jmeters.x86_64 -y

➜  ~ jmeters

Jmeters-0.4.1
(C) 2008-2012 Fons Adriaensen  <fons@linuxaudio.org>
Syntax: jmeters <options> <source | label>+
Options:
  -h         Display this text
  -t <type>  Meter type (vu, bbc, ebu, din, sbbc, sebu, sdin, cvu, cppm, cdin)
  -f <frame> Meter frame (rect, small, mbrl, mbrs)
  -r <v>     Reference level change (0 dB)
  -n <name>  Name to use as Jack client (jmeters)
  -u <n>     Update rate (20)
  -c <n>     Columns (4)
  -g <n>     Window geometry

###########################
#来自google翻译
Jmeters-0.4.1
(C)2008-2012 Fons Adriaensen <fons@linuxaudio.org>
语法:jmeters <options> <source |标签>+
选项:
   -h 帮助文档
   -t <type>电表类型(vu,bbc,ebu,din,sbbc,sebu,sdin,cvu,cppm,cdin)
   -f <帧>计帧(rect,small,mbrl,mbrs)
   -r <v>参考电平变化(0 dB)
   -n <name>用作Jack客户端的名称(jmeters)
   -u <n>更新率(20)
   -c <n>列(4)
   -g <n>窗口几何
###########################