Apache tiene una herramienta muy útil, Apache Benchmarking (ab), que nos va a servir para conocer un poco mejor como funciona nuestro servidor (o cualquier otro: en el ejemplo lo he probado con google.com) y que nos va a indicar parámetros tan interesantes como el nivel de carga que puede soportar, el numero de usuarios concurrentes (Concurrency Level), el tiempo de respuesta, etc…
La localización de Apache Benchmarking (ab) en Servidores con CentOS es:
/usr/local/apache/bin/ab
Y el comando para ejecutar ab es el siguiente (una vez situados en su directorio):
./ab -n 100 -c 5 http://google.com/
donde estamos indicando que haga el test con 100 conexiones (-n), limitandolo a 5 conexiones concurrentes (-c) en google.com. Es importante que no se os olvide terminar el comando con /
Este es el resultado que obtenemos al ejecutar Apache Benchmarking (ab):
[/usr/local/apache/bin]# ./ab -n 100 -c 5 http://google.com/
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking google.com (be patient)…..done
Server Software: gws
Server Hostname: google.com
Server Port: 80Document Path: /
Document Length: 219 bytesConcurrency Level: 5
Time taken for tests: 1.601 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Non-2xx responses: 100
Total transferred: 54000 bytes
HTML transferred: 21900 bytes
Requests per second: 62.46 [#/sec] (mean)
Time per request: 80.046 [ms] (mean)
Time per request: 16.009 [ms] (mean, across all concurrent requests)
Transfer rate: 32.94 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 38 39 0.4 38 39
Processing: 40 41 0.8 41 47
Waiting: 40 41 0.8 41 47
Total: 78 80 1.0 80 85
ERROR: The median and mean for the initial connection time are more than twice the standard
deviation apart. These results are NOT reliable.Percentage of the requests served within a certain time (ms)
50% 80
66% 80
75% 80
80% 80
90% 81
95% 81
98% 82
99% 85
100% 85 (longest request)
Podéis encontrar más referencias en: Howto: Performance Benchmarks a Webserver