ApacheBench: Difference between revisions

From ICO wiki
Jump to navigationJump to search
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Sissejuhatus =
ApacheBench on käsurea tööriis, mis on mõeldud veebiserverite testimiseks. Kasutades ApacheBenchi on võimalik saada ülevaade paigaldatud veebiserveri võimetest. Näidatakse kui palju taotlusi on veebiserver võimeline täitma erinevate koormuste juuras. See annab võimaluse testida veebiserveri käitumist tavakoormusel ning ka eriolukordades, kus pöördumiste arv serveri poole on suurem, kui tavaliselt.
Antud töös on kasutatud ApacheBench versiooni 2.3, ning see on paigaldatud Ubuntu operatsioonisüsteemiga arvutile. ApacheBench tarkvara paigaldamiseks tuleb käsurealt sisestada
sudo apt-get install apache2-utils
Testimiseks kasutatav veebiserver on Apache2, mis on paigaldatud Zentyal operatsioonisüsteemiga arvutile.
= Võtmed =
; Süntaks : ab [võtmed] [http[s]://]hostname[:port]/path
{|
|-
| '''-A''' || auth-username:password – kasutajanime ja parooli edastamine serverile (nimi ja parool on eraldatud „:“)
|-
| '''-c''' || concurrency – samaaegsete pöördumiste arv ajas. Vaikimisi väärtus on üks.
|-
| '''-C''' || cookie-name=value – Lisab „Cookie“ rea pöördumisele. Argument esitatakse nime=väärtuse paarina.
|-
| '''-d''' || Ei väljasta protsentuaalset esituse osakaalu ajaühikus.
|-
| '''-e''' || csv-file – Väljastab CSV (comma-separated values) faili, mis sisaldab iga protsendile pöördumistest kulunud aega.
|-
| '''-g''' || Väljastab tulemused TSV (Tab separate values) faili.
|-
| '''-h''' || Näitab abi informatsiooni.
|-
| '''-H''' || custom-header – Päise lisamiseks (nt: "Accept-Encoding: zip/zop;8bit").
|-
| '''-i''' || HEAD taotluse asemel GET taotlus.
|-
| '''-k''' || HTTP KeepAlive funktsiooni kasutamine.
|-
| '''-n''' || requests – Pöördumiste arv testimise käigus.
|-
| '''-p''' || POST-file – POSTle edastatavate andmetega fail.
|-
| '''-P''' || proxy-auth-username:password – kasutajanime ja parooli edastamiseks proxy serverile (nimi ja parool on eraldatud „:“)
|-
| '''-q''' || Ei väljastata jooksvalt testi läbinud katsete arvu.
|-
| '''-s''' || http asemel SSL kaitstud https protokoll. 
|-
| '''-S''' || Ei väljasta hoiatusi ega veateateid.
|-
| '''-t''' || timelimit – Maksimaalse testi kestvuse määramiseks.
|-
| '''-T''' || content-type – POST päise tüüp.
|-
| '''-v''' || verbosity – Kui palju probleemi uurimiseks informatsiooni väljastatakse.
|-
| '''-V''' || Näitab versiooni numbrit.
|-
| '''-w''' || Väljastab tulemuse html tabelina.
|-
| '''-x''' || ''<''table''>''-attributes – Sõne mis lisatakse, kui ''<''table''>'' atribuut.
|-
| '''-X''' || proxy[:port] – kasutatav proxy server ja port.
|-
| '''-y''' || ''<''tr''>''-attributes - Sõne mis lisatakse, kui ''<''tr''>'' atribuut.
|-
| '''-z''' || ''<''td''>''-attributes – Sõne mis lisatakse, kui ''<''td''>'' atribuut.
|}
= Näited =
Käsk väljastab ApacheBench kasutusjuhendi.
ab -h
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
    -t timelimit    Seconds to max. wait for responses
    -b windowsize  Size of TCP send/receive buffer, in bytes
    -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 for POSTing, 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.
    -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.
    -h              Display usage information (this message)
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol    Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
Testitakse serverit aadressil 192.168.56.40, kus samaaegsete pöördumiste arv on 250 ja pöördumiste arv testimise jooksul on 1000.
ab -c 250 -n 1000 192.168.56.40/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/<br>
Benchmarking 192.168.56.40 (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<br>
Server Software:        Apache/2.2.14
Server Hostname:        192.168.56.40
Server Port:            80<br>
Document Path:          /
Document Length:        45423 bytes<br>
Concurrency Level:      250
Time taken for tests:  7.716 seconds
Complete requests:      1000
Failed requests:        0
Write errors:          0
Total transferred:      45614000 bytes
HTML transferred:      45423000 bytes
Requests per second:    129.60 [#/sec] (mean)
Time per request:      1929.086 [ms] (mean)
Time per request:      7.716 [ms] (mean, across all concurrent requests)
Transfer rate:          5772.80 [Kbytes/sec] received<br>
Connection Times (ms)
              min  mean[+/-sd] median  max
Connect:        0  15 189.8      0    3010
Processing:    32 1257 1939.9    629    7697
Waiting:      19 1204 1902.9    588    7486
Total:        38 1272 1948.9    629    7711<br>
Percentage of the requests served within a certain time (ms)
  50%    629
  66%    659
  75%    688
  80%    732
  90%  3758
  95%  7024
  98%  7626
  99%  7664
100%  7711 (longest request)
Lisaks eelnevas näites toodule salvestatakse iga protsendile pöördumistest kulunud aeg  csv faili ning ei väljastata jooksvalt testis läbitud katsete arvu.
ab -q -e ab.csv -c 250 -n 1000 192.168.56.40/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/<br>
Benchmarking 192.168.56.40 (be patient).....done<br>
Server Software:        Apache/2.2.14
Server Hostname:        192.168.56.40
Server Port:            80<br>
Document Path:          /
Document Length:        45423 bytes<br>
Concurrency Level:      250
Time taken for tests:  8.302 seconds
Complete requests:      1000
Failed requests:        0
Write errors:          0
Total transferred:      45614000 bytes
HTML transferred:      45423000 bytes
Requests per second:    120.45 [#/sec] (mean)
Time per request:      2075.602 [ms] (mean)
Time per request:      8.302 [ms] (mean, across all concurrent requests)
Transfer rate:          5365.30 [Kbytes/sec] received<br>
Connection Times (ms)
              min  mean[+/-sd] median  max
Connect:        0  18 211.9      0    3008
Processing:    28 1242 1966.3    673    8283
Waiting:      22 1159 1884.2    599    7828
Total:        35 1260 1976.7    674    8297<br>
Percentage of the requests served within a certain time (ms)
  50%    674
  66%    708
  75%    725
  80%    737
  90%  2272
  95%  7362
  98%  8255
  99%  8282
100%  8297 (longest request)
ab.csv faili sisu
Percentage served,Time in ms
0,71.498
1,114.320
2,156.656
3,206.125
4,248.552
5,291.920
6,335.650
7,375.084
8,413.947
9,447.739
10,486.873
...
99,8596.502
= Kasutatud kirjandus =
http://httpd.apache.org/docs/2.0/programs/ab.html
= Koostas =
Toomas Rohumets A31
02.10.2011
[[Category:IT infrastruktuuri teenused]]
[[Category:IT infrastruktuuri teenused]]

Latest revision as of 17:25, 2 October 2011

Sissejuhatus

ApacheBench on käsurea tööriis, mis on mõeldud veebiserverite testimiseks. Kasutades ApacheBenchi on võimalik saada ülevaade paigaldatud veebiserveri võimetest. Näidatakse kui palju taotlusi on veebiserver võimeline täitma erinevate koormuste juuras. See annab võimaluse testida veebiserveri käitumist tavakoormusel ning ka eriolukordades, kus pöördumiste arv serveri poole on suurem, kui tavaliselt.

Antud töös on kasutatud ApacheBench versiooni 2.3, ning see on paigaldatud Ubuntu operatsioonisüsteemiga arvutile. ApacheBench tarkvara paigaldamiseks tuleb käsurealt sisestada

sudo apt-get install apache2-utils 

Testimiseks kasutatav veebiserver on Apache2, mis on paigaldatud Zentyal operatsioonisüsteemiga arvutile.

Võtmed

Süntaks
ab [võtmed] [http[s]://]hostname[:port]/path
-A auth-username:password – kasutajanime ja parooli edastamine serverile (nimi ja parool on eraldatud „:“)
-c concurrency – samaaegsete pöördumiste arv ajas. Vaikimisi väärtus on üks.
-C cookie-name=value – Lisab „Cookie“ rea pöördumisele. Argument esitatakse nime=väärtuse paarina.
-d Ei väljasta protsentuaalset esituse osakaalu ajaühikus.
-e csv-file – Väljastab CSV (comma-separated values) faili, mis sisaldab iga protsendile pöördumistest kulunud aega.
-g Väljastab tulemused TSV (Tab separate values) faili.
-h Näitab abi informatsiooni.
-H custom-header – Päise lisamiseks (nt: "Accept-Encoding: zip/zop;8bit").
-i HEAD taotluse asemel GET taotlus.
-k HTTP KeepAlive funktsiooni kasutamine.
-n requests – Pöördumiste arv testimise käigus.
-p POST-file – POSTle edastatavate andmetega fail.
-P proxy-auth-username:password – kasutajanime ja parooli edastamiseks proxy serverile (nimi ja parool on eraldatud „:“)
-q Ei väljastata jooksvalt testi läbinud katsete arvu.
-s http asemel SSL kaitstud https protokoll.
-S Ei väljasta hoiatusi ega veateateid.
-t timelimit – Maksimaalse testi kestvuse määramiseks.
-T content-type – POST päise tüüp.
-v verbosity – Kui palju probleemi uurimiseks informatsiooni väljastatakse.
-V Näitab versiooni numbrit.
-w Väljastab tulemuse html tabelina.
-x <table>-attributes – Sõne mis lisatakse, kui <table> atribuut.
-X proxy[:port] – kasutatav proxy server ja port.
-y <tr>-attributes - Sõne mis lisatakse, kui <tr> atribuut.
-z <td>-attributes – Sõne mis lisatakse, kui <td> atribuut.


Näited

Käsk väljastab ApacheBench kasutusjuhendi.

ab -h
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
   -t timelimit    Seconds to max. wait for responses
   -b windowsize   Size of TCP send/receive buffer, in bytes
   -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 for POSTing, 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.
   -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.
   -h              Display usage information (this message)
   -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
   -f protocol     Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)

Testitakse serverit aadressil 192.168.56.40, kus samaaegsete pöördumiste arv on 250 ja pöördumiste arv testimise jooksul on 1000.

ab -c 250 -n 1000 192.168.56.40/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.56.40 (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: Apache/2.2.14 Server Hostname: 192.168.56.40 Server Port: 80
Document Path: / Document Length: 45423 bytes
Concurrency Level: 250 Time taken for tests: 7.716 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 45614000 bytes HTML transferred: 45423000 bytes Requests per second: 129.60 [#/sec] (mean) Time per request: 1929.086 [ms] (mean) Time per request: 7.716 [ms] (mean, across all concurrent requests) Transfer rate: 5772.80 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 15 189.8 0 3010 Processing: 32 1257 1939.9 629 7697 Waiting: 19 1204 1902.9 588 7486 Total: 38 1272 1948.9 629 7711
Percentage of the requests served within a certain time (ms) 50% 629 66% 659 75% 688 80% 732 90% 3758 95% 7024 98% 7626 99% 7664 100% 7711 (longest request)

Lisaks eelnevas näites toodule salvestatakse iga protsendile pöördumistest kulunud aeg csv faili ning ei väljastata jooksvalt testis läbitud katsete arvu.

ab -q -e ab.csv -c 250 -n 1000 192.168.56.40/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.56.40 (be patient).....done
Server Software: Apache/2.2.14 Server Hostname: 192.168.56.40 Server Port: 80
Document Path: / Document Length: 45423 bytes
Concurrency Level: 250 Time taken for tests: 8.302 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 45614000 bytes HTML transferred: 45423000 bytes Requests per second: 120.45 [#/sec] (mean) Time per request: 2075.602 [ms] (mean) Time per request: 8.302 [ms] (mean, across all concurrent requests) Transfer rate: 5365.30 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 18 211.9 0 3008 Processing: 28 1242 1966.3 673 8283 Waiting: 22 1159 1884.2 599 7828 Total: 35 1260 1976.7 674 8297
Percentage of the requests served within a certain time (ms) 50% 674 66% 708 75% 725 80% 737 90% 2272 95% 7362 98% 8255 99% 8282 100% 8297 (longest request)

ab.csv faili sisu

Percentage served,Time in ms
0,71.498
1,114.320
2,156.656
3,206.125
4,248.552
5,291.920
6,335.650
7,375.084
8,413.947
9,447.739
10,486.873
...
99,8596.502

Kasutatud kirjandus

http://httpd.apache.org/docs/2.0/programs/ab.html

Koostas

Toomas Rohumets A31

02.10.2011