Apache Benchmark (ab)

Apache Benchmark es una gran utilidad para auto denegarnos servicios probar la capacidad de nuestro web-server, de forma general nos sirve para ver la cantidad de peticiones por segundo que es capas de realizar, obviamente esto dependera en gran medida del hardware que tengamos, y de la pagina victima ya que no es igual lanzar peticiones a una pagina HTML de 10 lineas que a una de 2000, su uso aunque a primera vista puede parecer complicado en realidad no lo es tanto, de hecho generalmente solo se usan 2 flags u opciones, que son -n para la cantidad de consultas y -c para la cantidad de concurrencia (numero de consultas al mismo tiempo) su “help” es tambien bastante informativo:

Usage: ab [options] [http://]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
    -p postfile     File containing data to POST
    -T content-type Content-type header for POSTing
    -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
    -h              Display usage information (this message)

Entonces digamos, para probar una pagina bastaria con usar la siguiente linea:

# ab -n100 -c5 http://RUTA/index.html

Popularity: 36% [?]



Wikipedia:  HTML   Enlaces relacionados:
  • Optimizando nuestro servidor
  • Familiarizandonos con los logs de Linux
  • Algunos comandos poco conocidos pero muy utiles
  • Leave a Reply