Tester basiquement la tenue de charge d’un site web

Pré-requis : une machine sous linux/freebsd avec une bonne connectivité ( latence surtout et débit ).

Pour tester de façon basique et rapide, la tenue de charge d’une machine, apache fourni l’outil ab ( Apache Benchmark ).

Il permet d’ouvrir X connections simultanées sur un site internet de faire Y requêtes. Pour des tests plus élaborés ( scénarios de navigation ), je vous conseille de vous tourner vers jmeter.

Dans le même temps, pour obtenir les meilleurs résultats, il vous faut monitorer votre machine ( article a venir .. ) afin de pouvoir analyser finement son comportement et éventuellement l’optimiser plus ..

Ainsi, on va commencer petit :

guillaume@mars:~ # ab -n1000 -c 10 http://test-joomla.domaine.com/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking test-joomla.domaine.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
Finished 1000 requests
Server Software:        Apache/2.2.16
Server Hostname:        test-joomla.domaine.com
Server Port:            80
Document Path:          /
Document Length:        15155 bytes
Concurrency Level:      10
Time taken for tests:   42.77887 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      15558543 bytes
HTML transferred:       15170155 bytes
Requests per second:    23.77 [#/sec] (mean)
Time per request:       420.779 [ms] (mean)
Time per request:       42.078 [ms] (mean, across all concurrent requests)
Transfer rate:          361.07 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4    4   0.4      4       7
Processing:   222  414  58.0    413     835
Waiting:      211  381  48.1    383     524
Total:        226  418  58.0    417     839
Percentage of the requests served within a certain time (ms)
  50%    417
  66%    439
  75%    452
  80%    462
  90%    481
  95%    500
  98%    522
  99%    555
 100%    839 (longest request)

Le serveur est donc capable de nous servir la page d’accueil jusqu’à 23 fois à la seconde, en prenant 42ms par requête. Par ailleurs, effectivement des outils de monitoring montrent une utilisation autour des 60 pourcent, ce qui semble logique au vu de nos 10 requêtes concurrentes..

On va re-essayer avec 23 requetes concurrentes :

yomgui@mars:~ # ab -n2000 -c 23 http://test-joomla.faistonweb.com/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking test-joomla.faistonweb.com (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
Completed 800 requests
Completed 1000 requests
Completed 1200 requests
Completed 1400 requests
Completed 1600 requests
Completed 1800 requests
Finished 2000 requests
Server Software:        Apache/2.2.16
Server Hostname:        test-joomla.faistonweb.com
Server Port:            80
Document Path:          /
Document Length:        15155 bytes
Concurrency Level:      23
Time taken for tests:   84.575933 seconds
Complete requests:      2000
Failed requests:        0
Write errors:           0
Total transferred:      31101543 bytes
HTML transferred:       30325155 bytes
Requests per second:    23.65 [#/sec] (mean)
Time per request:       972.623 [ms] (mean)
Time per request:       42.288 [ms] (mean, across all concurrent requests)
Transfer rate:          359.11 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4   68 435.2      4    3004
Processing:   391  898 163.8    941    1563
Waiting:      348  821 142.1    867    1107
Total:        395  967 472.6    946    4117
Percentage of the requests served within a certain time (ms)
  50%    946
  66%    974
  75%    993
  80%   1005
  90%   1042
  95%   1081
  98%   3876
  99%   3957
 100%   4117 (longest request)