Nombre total de pages vues

lundi 3 octobre 2011

Apache benchmark with Siege


Siege is an http load testing and benchmarking utility. It was designed to let web developers measure their code under duress, to see how it will stand up to load on the internet. Siege supports basic authentication, cookies, HTTP and HTTPS protocols. It lets its user hit a web server with a configurable number of simulated web browsers. Those browsers place the server "under siege."

Siege can be installed with yum (2.66 version from rpmforge repo or 2.70 version from epel repo) or from sources that can be found on the project website. In our case, we will use rpm package from epel repo.

Installation and initial configuration :
[root@localhost ~]# yum install siege -y
[root@localhost ~]# siege.config
New configuration template added to /root/.siegerc
Run siege -C to view the current settings in that file
[root@localhost ~]# siege -C
CURRENT  SIEGE  CONFIGURATION
JoeDog/1.00 [en] (X11; I; Siege 2.70)
Edit the resource file to change the settings.
----------------------------------------------
version:                        2.70
verbose:                        true
debug:                          false
protocol:                       HTTP/1.1
connection:                     close
concurrent users:               15
time to run:                    n/a
repetitions:                    n/a
socket timeout:                 30
delay:                          1 sec
internet simulation:            false
benchmark mode:                 false
failures until abort:           1024
named URL:                      none
URLs file:                      /usr/etc/urls.txt
logging:                        true
log file:                       /var/siege.log
resource file:                  /root/.siegerc
allow redirects:                true
allow zero byte data:           true
allow chunked encoding:         true
proxy auth:
www auth:
Available options:
[root@localhost ~]# siege -h
SIEGE 2.70
Usage: siege [options]
       siege [options] URL
       siege -g URL
Options:
  -V, --version           VERSION, prints the version number.
  -h, --help              HELP, prints this section.
  -C, --config            CONFIGURATION, show the current config.
  -v, --verbose           VERBOSE, prints notification to screen.
  -g, --get               GET, pull down HTTP headers and display the
                          transaction. Great for application debugging.
  -c, --concurrent=NUM    CONCURRENT users, default is 10
  -i, --internet          INTERNET user simulation, hits URLs randomly.
  -b, --benchmark         BENCHMARK: no delays between requests.
  -t, --time=NUMm         TIMED testing where "m" is modifier S, M, or H
                          ex: --time=1H, one hour test.
  -r, --reps=NUM          REPS, number of times to run the test.
  -f, --file=FILE         FILE, select a specific URLS FILE.
  -R, --rc=FILE           RC, specify an siegerc file
  -l, --log[=FILE]        LOG to FILE. If FILE is not specified, the
                          default is used: PREFIX/var/siege.log
  -m, --mark="text"       MARK, mark the log file with a string.
  -d, --delay=NUM         Time DELAY, random delay before each requst
                          between 1 and NUM. (NOT COUNTED IN STATS)
  -H, --header="text"     Add a header to request (can be many)
  -A, --user-agent="text" Sets User-Agent in request

Copyright (C) 2010 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
Testing:
[root@localhost ~]# siege -b -c 10 -r 3 http://nuxadmin.blogspot.com
** SIEGE 2.70
** Preparing 10 concurrent users for battle
The server is now under siege...
HTTP/1.1 200   1.04 secs:   95476 bytes ==> /
HTTP/1.1 200   1.17 secs:   95476 bytes ==> /
HTTP/1.1 200   1.19 secs:   95476 bytes ==> /
HTTP/1.1 200   1.56 secs:   95476 bytes ==> /
HTTP/1.1 200   1.80 secs:   95476 bytes ==> /
HTTP/1.1 200   0.79 secs:   95476 bytes ==> /
HTTP/1.1 200   1.85 secs:   95476 bytes ==> /
HTTP/1.1 200   2.07 secs:   95476 bytes ==> /
HTTP/1.1 200   1.12 secs:   95476 bytes ==> /
HTTP/1.1 200   0.81 secs:   95476 bytes ==> /
HTTP/1.1 200   2.78 secs:   95476 bytes ==> /
HTTP/1.1 200   1.07 secs:   95476 bytes ==> /
HTTP/1.1 200   0.85 secs:   95476 bytes ==> /
HTTP/1.1 200   2.93 secs:   95476 bytes ==> /
HTTP/1.1 200   1.15 secs:   95476 bytes ==> /
HTTP/1.1 200   0.91 secs:   95476 bytes ==> /
HTTP/1.1 200   2.16 secs:   95476 bytes ==> /
HTTP/1.1 200   1.68 secs:   95476 bytes ==> /
HTTP/1.1 200   1.31 secs:   95476 bytes ==> /
HTTP/1.1 200   0.78 secs:   95476 bytes ==> /
HTTP/1.1 200   1.20 secs:   95476 bytes ==> /
HTTP/1.1 200   1.37 secs:   95476 bytes ==> /
HTTP/1.1 200   2.00 secs:   95476 bytes ==> /
HTTP/1.1 200   1.45 secs:   95476 bytes ==> /
HTTP/1.1 200   1.36 secs:   95476 bytes ==> /
HTTP/1.1 200   0.61 secs:   95476 bytes ==> /
HTTP/1.1 200   0.58 secs:   95476 bytes ==> /
HTTP/1.1 200   5.55 secs:   95476 bytes ==> /
HTTP/1.1 200   0.49 secs:   95476 bytes ==> /
HTTP/1.1 200   0.47 secs:   95476 bytes ==> /
done.                                                                                                                                                             Transactions:                      30 hits
Availability:                 100.00 %
Elapsed time:                   6.52 secs<
Data transferred:               2.73 MB
Response time:                  1.47 secs
Transaction rate:               4.60 trans/sec
Throughput:                     0.42 MB/sec
Concurrency:                    6.76
Successful transactions:          30
Failed transactions:               0
Longest transaction:            5.55
Shortest transaction:           0.47

FILE: /var/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false
Another test:
[root@localhost ~]# siege -c 30 -i -t 30s -d 5 http://nuxadmin.blogspot.com
...
Lifting the server siege...      done.                                           Transactions:                     167 hits
Availability:                 100.00 %
Elapsed time:                  29.59 secs
Data transferred:              15.21 MB
Response time:                  2.48 secs
Transaction rate:               5.64 trans/sec
Throughput:                     0.51 MB/sec
Concurrency:                   13.99
Successful transactions:         167
Failed transactions:               0
Longest transaction:            6.84
Shortest transaction:           0.78
...

Aucun commentaire:

Enregistrer un commentaire