At work I have been using ApacheBench to help bench mark performance. It is a fabulous tool. After upgrading my OS to Lion, ApacheBench (ab) fails to run. Here was my error:

Scott ~/src: ab -n 5000 -c 100 
This is ApacheBench, Version 2.3 <$Revision: 655654 $> 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, 
Licensed to The Apache Software Foundation, 
Benchmarking (be patient) 
Send request failed! 
apr_socket_recv: Connection reset by peer (54)

Apparently there is a patch to fix it, here, but I could not get it to work. That and the post is in another language, that google did a sos-so job of translating. I had read somewhere that this was fixed in new version of apache, version 2.3.14 (download here), which is in beta. I didn’t need to (or want to) install all of Apache, just ApacheBench so I compiled the source and copied over the binary. Here are the steps:

Scott ~/Desktop: cp ./support/.libs/ab /usr/local/apache2/bin/ab
./configure --prefix=/usr/local/apache2
make install
which ab output
--> /usr/sbin/ab
cd /usr/local/apache2/bin/
cp ab  /usr/sbin/ab
sudo cp ab  /usr/sbin/ab

Success! Back to normal, everything is working again.

11 Responses to “ApacheBench fails after Mac OSX Lion Upgrage apr_socket_recv: Connection reset by peer (54)”

  1. You may want to check out similar tools as well, like siege and http_load. I like ab, it is simple and easy to use.

    At one point though it had issues in some cases:

    where it would return results that clearly were not correct.

    At the time ( a few years ago ) I was able to reproduce the issues that Paul saw in specific cases, but not in others. I haven’t run these recently so I can’t say if this is still an issue.

    Something to keep in mind if you start seeing results that go against the obvious.

    Joseph Scott

  2. Thanks for sharing man ,


  3. Hi. I’m trying to follow the code snippet above.

    The line the copies stuff “cp ./support/.libs/ab”… where did you get /support/libs/ab from?



  4. Hi,

    You have to download the httpd source first.
    Here is an updated link:


  5. I was just bitten by this, too. I was all psyched about benching my new web app and felt very disappointed when `ab` returned the errors you mentioned. At first I thought it was my app, which would be really bad. But when I still got the same error after I had lowered the concurrency count to 1 and the max requests to 10, I knew something was either really amiss with my app server, OS X’s networking stack was boofed, or `ab` had problems. Thanks for reporting this so I didn’t have to go on a long, wild goose chase.

    Michael Chang

  6. Thanks for posting.

    Btw, we only have to build a new ab, so only have to make in support folder. :)


  7. sevosa

  8. @sevosa I took out an extra “/” in the url. I think that was causing the issue. Try it now.


  9. The version is now available in the apache archives:


  10. After recompiled new Apache version, I had got error too.
    Then I use option -r
    ab -n1000 -c20 -r


  11. The latest version (2.4.2) has another bug. A fix and a homebrew formula are available at


Leave a Reply