# Performance choking around 400 req/sec?

**URL:** <https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803>\
**Category:** NGINX\
**Created:** [April 12, 2012, 1:44pm UTC](https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803 "2012-04-12T13:44:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 12, 2012, 1:44pm UTC](https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803/1 "2012-04-12T13:44:21Z")

</div>

Hi everyone,

I should start by saying I am a newbie and have recently started using  
NGINX and VERYY happy with it. But, I have been trying to run some  
stress tests on NGINX (hitting a static file), and it looks like no  
matter what I do, server is choking at around 400 req/sec. Isn’t this  
too low for a static file on NGINX? Am I doing something wrong?

I have increased hard/soft limit to 30K/10K. My machine is reasonably  
powerful (quad-core i7 with 8gb RAM) and during the tests, CPU load is  
pretty low.

I used apache bench to do performance testing and I am hitting a  
static file on local filesystem. I ran the test from 2 different  
machines (nginx is on the 3rd machine) and used the following command  
on each starting at the same time:

ab -n 10000 -c 400 [http://mydomain.com/static.html](http://mydomain.com/static.html)

Results of one of these is below:

Document Length: 29638 bytes

Concurrency Level: 400  
Time taken for tests: 33.856 seconds  
Complete requests: 10000  
Failed requests: 0  
Write errors: 0  
Total transferred: 300038664 bytes  
HTML transferred: 297222704 bytes  
Requests per second: 295.37 [#/sec] (mean)  
Time per request: 1354.241 [ms] (mean)  
Time per request: 3.386 [ms] (mean, across all concurrent  
requests)  
Transfer rate: 8654.48 [Kbytes/sec] received

Connection Times (ms)  
min mean[+/-sd] median max  
Connect: 6 448 1276.7 113 21113  
Processing: 120 840 621.7 570 5980  
Waiting: 5 186 176.3 114 2200  
Total: 132 1288 1420.9 695 23143

Percentage of the requests served within a certain time (ms)  
50% 695  
66% 1134  
75% 1474  
80% 1721  
90% 3027  
95% 3685  
98% 4688  
99% 6445  
100% 23143 (longest request)

Am I missing something here??? Relevant parts of NGINX Conf:

worker\_processes 6;  
worker\_rlimit\_nofile 30000;

events {  
worker\_connections 1024;  
# multi\_accept on;  
}

http {

```
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    log_format combined_perf '$remote_addr - $remote_user 

```

[$time\_local] ’  
'“$request” $status $body\_bytes\_sent ’  
'“$http\_referer” “$http\_user\_agent” ’  
‘[$request\_time /  
$upstream\_response\_time]’;

```
    access_log /var/log/nginx/root/access.log combined_perf;
    error_log /var/log/nginx/root/error.log error;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

```

}

Thanks a ton!

---

<div class="post-metadata">

**Author:** ![Cabbar\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@Cabbar\_D](https://www.ruby-forum.com/u/Cabbar_D)\
**Post date:** [April 12, 2012, 1:45pm UTC](https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803/2 "2012-04-12T13:45:36Z")

</div>

Ah, forgot to mention that this is on a Ubuntu 11.10 box.

---

<div class="post-metadata">

**Author:** ![Cabbar\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@Cabbar\_D](https://www.ruby-forum.com/u/Cabbar_D)\
**Post date:** [April 12, 2012, 5:17pm UTC](https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803/3 "2012-04-12T17:17:38Z")

</div>

> I have increased hard/soft limit to 30K/10K. My machine is reasonably powerful  
> (quad-core i7 with 8gb RAM) and during the tests,  
> CPU load is  
> pretty low.  
> I used apache bench to do performance testing and I am hitting a static file on  
> local filesystem. I ran the test from 2 different  
> machines (nginx is on the 3rd machine) and used the following command on  
> each starting at the same time:

> Transfer rate: 8654.48 [Kbytes/sec] received

To be sure - what is your network speed (on the testboxes too)?  
In case it’s like 100mbit then running ‘ab’ on 2 remote boxes each doing  
8Mb/s download pretty much saturates the whole link and  
there is nothing nginx can do.

Have you tried to do a local (on the same box) ‘ab’ bench or with  
smaller file like 1kb ?

rr

---

<div class="post-metadata">

**Author:** ![Cabbar\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@Cabbar\_D](https://www.ruby-forum.com/u/Cabbar_D)\
**Post date:** [April 14, 2012, 1:35am UTC](https://www.ruby-forum.com/t/performance-choking-around-400-req-sec/218803/4 "2012-04-14T01:35:23Z")

</div>

Ah, that is exactly what the issue is… Server has 100 megabit/sec  
and it was limited by that. When I tested it with a 1 KB file, I was  
5K req/sec

Thank a ton!
