ab: Apache HTTP server benchmarking tool

Robin Kim
therobinkim
Published in
1 min readAug 7, 2015

ab is a tool for benchmarking your Apache HTTP server. (source)

I saw Ryan Dahl’s Introduction to Node presentation where he used the ab command line utility.

He demonstrated Node’s asynchronous capabilities by first setting a setTimeout in his Node server of 1000ms, then using ab to submit multiple, concurrent requests.

Dahl was trying to demonstrate how if Node did not handle each request asynchronously, 10 requests would take 10 seconds. However, his very simple Node server was able to process all 10 requests in just over 1 second.

ab -c 100 -n 100 -p fileToSendAsPostRequest.txt -r http://localhost:8000/

  • -c asks for the number of concurrent requests to make
  • -n asks for the number of requests to make (if -c is missing, ab will complete each request one at a time)
  • -p allows us to send a file as part of a post request
  • -r tells ab to not exit when it hits an error (when I tried to submit 1000 requests concurrently, I ran into an error: apr_socket_recv: Connection reset by peer (54), oops!)

--

--

Robin Kim
therobinkim

Full stack software engineer. I teach at Hack Reactor Remote @ Galvanize.