# Using ab to benchmark nginx: Connection reset by peer (54)

**URL:** <https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004>\
**Category:** NGINX\
**Created:** [November 18, 2011, 12:56pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004 "2011-11-18T12:56:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [November 18, 2011, 12:56pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/1 "2011-11-18T12:56:04Z")

</div>

I recently updated to nginx 1.0.8 and tried to benchmark performance for  
cached dynamic pages (initially served by a Django app via proxy\_pass)  
and for static pages. In both cases, nginx will not serve more than 3 or  
4 requests (even without concurrent connections), so ab almost  
immediately reports:

Benchmarking testsite.static (be patient)…apr\_socket\_recv: Connection  
reset by peer (54)

It is only when choosing a maximum of 4 (or fewer) requests that ab  
finishes successfully.

Why is that? I tried increasing the number of worker processes (no  
luck), but I assume that nginx should be capable of serving more than 4  
requests without tweaking any configuration variable. Could it be that I  
accidentally triggered some sort of DOS protection mechanism?

Posted at Nginx Forum:

> **[Using ab to benchmark nginx: Connection reset by peer (54)](https://forum.nginx.org/read.php?2,218554,218554#msg-218554)**
>
> I recently updated to nginx 1.0.8 and tried to benchmark performance for cached dynamic pages (initially served by a Django app via proxy\_pass) and for static pages. In both cases, nginx will not serve more than 3 or 4 requests (even without...

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 18, 2011, 3:11pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/2 "2011-11-18T15:11:09Z")

</div>

Hello!

On Fri, Nov 18, 2011 at 06:55:40AM -0500, janedenone wrote:

> finishes successfully.
> 
> Why is that? I tried increasing the number of worker processes (no  
> luck), but I assume that nginx should be capable of serving more than 4  
> requests without tweaking any configuration variable. Could it be that I  
> accidentally triggered some sort of DOS protection mechanism?

By default there are no anti-DoS protections are activated in  
nginx. If you’ve activated some - it may be the reason. Looking  
into error may shed some light on the issue.

Alternatively, it may be some other limits, e.g. your firewall  
ones.

Maxim D.

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 18, 2011, 3:42pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/3 "2011-11-18T15:42:09Z")

</div>

Thanks – there is no firewall (the test is run on my local machine),  
and the error.log shows nothing. I increased the log level, only to see  
notifications about exiting worker and cache processes.

Posted at Nginx Forum:

> **[Re: Using ab to benchmark nginx: Connection reset by peer (54)](https://forum.nginx.org/read.php?2,218554,218563#msg-218563)**
>
> I recently updated to nginx 1.0.8 and tried to benchmark performance for cached dynamic pages (initially served by a Django app via proxy\_pass) and for static pages. In both cases, nginx will not serve more than 3 or 4 requests (even without...

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 18, 2011, 4:36pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/4 "2011-11-18T16:36:42Z")

</div>

agentzh Wrote:

> What kind of system are you in? ab is known to  
> have such issues in  
> certain Mac OS X boxes to my knowledge 🙂

Well – Mac OS X. 🙂 Are these issues to the ab version that comes with  
OS X, or are they related to the OS in general? In the former case, I’d  
just recompile ab manually.

Thanks!

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,218554,218571#msg-218571](http://forum.nginx.org/read.php?2,218554,218571#msg-218571)

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 23, 2011, 11:43am UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/5 "2011-11-23T11:43:55Z")

</div>

## agentzh Wrote:

> -agentzh  
> Thanks a lot – I now use the -r flag, which makes ab proceed in spite  
> of failed requests.

- jan

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,218554,218789#msg-218789](http://forum.nginx.org/read.php?2,218554,218789#msg-218789)

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 18, 2011, 4:26pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/6 "2011-11-18T16:26:48Z")

</div>

On Fri, Nov 18, 2011 at 7:55 PM, janedenone [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I recently updated to nginx 1.0.8 and tried to benchmark performance for  
> cached dynamic pages (initially served by a Django app via proxy\_pass)  
> and for static pages. In both cases, nginx will not serve more than 3 or  
> 4 requests (even without concurrent connections), so ab almost  
> immediately reports:
> 
> Benchmarking testsite.static (be patient)…apr\_socket\_recv: Connection  
> reset by peer (54)

What kind of system are you in? ab is known to have such issues in  
certain Mac OS X boxes to my knowledge 🙂

Regards,  
-agentzh

---

<div class="post-metadata">

**Author:** ![janedenone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/da6949/32.png) [@janedenone](https://www.ruby-forum.com/u/janedenone)\
**Post date:** [November 18, 2011, 4:41pm UTC](https://www.ruby-forum.com/t/using-ab-to-benchmark-nginx-connection-reset-by-peer-54/214004/7 "2011-11-18T16:41:39Z")

</div>

On Fri, Nov 18, 2011 at 11:36 PM, janedenone [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> agentzh Wrote:
> 
> > What kind of system are you in? ab is known to  
> > have such issues in  
> > certain Mac OS X boxes to my knowledge 🙂
> 
> Well Mac OS X. 🙂 Are these issues to the ab version that comes with  
> OS X, or are they related to the OS in general? In the former case, I’d  
> just recompile ab manually.

On Mac OS X 10.6, I have to use “127.0.0.1” instead of “localhost”  
while running the ab command, or I’ll get exactly the same error  
message.

And for 10.7 (Lion), people say they have to apply a patch to ab to get  
it work.

Hope this helps,  
-agentzh
