Nginx Windows High Traffic issues

So i spent a while on this one and turns out the problem is a little
function in nginx’s core called “worker_rlimit_nofile”.

But for me on windows (i don’t know if it does it for linux users too.)
grinds my site down to a halt unless you increase its value.

Why does it do this ?
http://nginx.org/en/docs/ngx_core_module.html#worker_rlimit_nofile

Even with the following nginx builds for high traffic production
enviorments
http://nginx-win.ecsds.eu/ It still seems like the worker_rlimit_nofile
is
to small by default on nginx start up so unless you know to add the
command
into your nginx config with some insanely high value to it your site
will
seem slow as hell.

I read on stackoverflow the following.
events {
worker_connections 19000; # It’s the key to high performance -
have a
lot of connections available
}

worker_rlimit_nofile 20000; # Each connection needs a filehandle (or
2
if you are proxying)

But in my config i set the following just to test
events {
worker_connections 16384;
multi_accept on;
}
worker_rlimit_nofile 9990000000;

And everything still works fine can anyone explain so i can understand
why
this value is so small in the first place ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251186#msg-251186

The way things have been redesigned, worker_rlimit_nofile has no purpose
anymore, it’s best not to set any value.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251187#msg-251187

Well without a value everything is very very slow. With a value its nice
and
fast.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251188#msg-251188

I recon its because i have media sites with lots of files and pictures
videos content etc so i need it to be a large limit.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251192#msg-251192

c0nw0nk Wrote:

Well without a value everything is very very slow. With a value its
nice and fast.

Interesting to know, the Windows design and other portions scale
automatically between 4 API’s to deal with high performance while
offloading
that to multiple workers at the same time. This design is limitless but
some
baseline values have been set fixed because you need to start somewhere
before tuning runs and after all workers have settled down.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251194#msg-251194

I don’t know how you would try to replicate this issue because i have
thousands upon thousands of files being accessed simultaneously without
me
setting that value insanely high pages and access to thing take 10
seconds
and more even timeouts was occurring but as soon as i set that value it
all
stops and everything seems to be running fast as its suppose to.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251196#msg-251196

Hello!

On Thu, Jun 26, 2014 at 09:41:15AM -0400, c0nw0nk wrote:

So i spent a while on this one and turns out the problem is a little
function in nginx’s core called “worker_rlimit_nofile”.

But for me on windows (i don’t know if it does it for linux users too.)
grinds my site down to a halt unless you increase its value.

Why does it do this ?
http://nginx.org/en/docs/ngx_core_module.html#worker_rlimit_nofile

On unix, worker_rlimit_nofile does exactly what’s documented: it
calls setrlimit(RLIMIT_NOFILE) within worker process. This allows
to change OS-imposed limit without restarting nginx. And there is
no default in nginx itself - the default is set by OS and it’s
configuration.

Note well that the words “without restarting” is actually the
reason why this directive exists at all. If a restart isn’t a big
deal, then OS limit can be changed by native means (“ulimit -n”
and friends).

In official nginx on Windows, worker_rlimit_nofile does nothing.
Not sure if there is an equivalent limit on Windows at all.


Maxim D.
http://nginx.org/

Could it be possible my server slows down because all connections are in
use
?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251201#msg-251201

Maxim D. Wrote:

grinds my site down to a halt unless you increase its value.
Note well that the words “without restarting” is actually the


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

I find it very hard to believe it does nothing without me setting it
everything is very slow ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251200#msg-251200

Now i am clueless because i dropped keepalive requests i also dropped
any
send_timeout values.

And this is what my bandwidth output looks like its very jumpy when it
should not be and my page loads are very slow even on static files like
html, mp4, flv etc and considering its nginx that delievers them i am
very
sure nginx is the problem.
http://i633.photobucket.com/albums/uu52/C0nw0nk/Untitled-4.png

Something is very wrong with nginx i recon i am completely out of
connections avaliable and it is waiting for a connection to open to use.

Unless anyone knows what i could be needing to add to my config so that
while people are downloading/streaming videos that are upto 500mb in
size.

I already use limit_rate but with that my bandwidth output should not be
jumpy like in the picture it would be a straight smooth line like it
used to
be but with more traffic i recon my connection limit is reached ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251206#msg-251206

When i said “my bandwidth output looks like its very jumpy”. on a 1gig
per
second connection my output jumps up and down 10% (100mb) used then it
will
jump to like 40% (400mb) and it changes so much before when i had less
traffic it used to be a very stead and stable 400-500mb output and
hardly
ever changed so dramaticly.

In the following screenshot you will see me I/O usage from Nginx is
extremely high.
http://s633.photobucket.com/user/C0nw0nk/media/Untitled-5.png.html

And i would like to add the only reason in that picture the nginx
processes
are using so much memory is because i set the “worker_connections
1900000;”
to a high value. I don’t know if it should use so much memory or if it
is
just wasting my system resources.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251207#msg-251207

This is a disk IO issue, not running out of connections, setting 1900000
is
pointless, 16k is more then enough, no more then 2 workers per cpu, I
see 12
workers so do you have enough cpu’s to cover that?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251210#msg-251210

c0nw0nk Wrote:

Could it be possible my server slows down because all connections are
in use ?

No, it’s a recycling and auto-tuning issue as far as I can see, have you
determined at which value you noticed the difference or is this value
simply
a big number ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251204#msg-251204

Looking at the disk activity access to disk is using all your resources
not
nginx.
Here http://s633.photobucket.com/user/C0nw0nk/media/Untitled-5.png.html
you
see nginx itself is waiting for disk IO to complete, all processes are
doing
just about nothing other then waiting for the harddisk, the main waiting
issue looks like it is writing to disk which isn’t going fast enough.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251237#msg-251237

I also just to try and check if it was my connection limit enabled
nginx_status and this was my output.

Active connections: 1032
server accepts handled requests
8335 8335 12564
Reading: 0 Writing: 197 Waiting: 835

How can i fix the I/O issue why is nginx consuming so much in the first
place if i close the nginx process nothing else is even using it.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251232#msg-251232

It all depends what you are writing, too small blocksize, many seeks,
onboard diskcache not working (writeback). Run some disk benchmarks to
see
what your storage is capable of and compare that to how much data your
attempting to write. At the moment your disks are not keeping up with
the
amount of write requests.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251246#msg-251246

So the soloution could be a different hard drive possibly a solid state
drive ? This is my current hard drive
http://www.hgst.com/hard-drives/enterprise-hard-drives/enterprise-sata-drives/ultrastar-7k4000

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251238#msg-251238

Try via a forum like
http://www.overclock.net/t/1193676/looking-for-hdd-benchmark-utility

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251249#msg-251249

Since i have never had to benchmark a hard drive before this will be a
new
experience for me any tools you recommend to use specifically.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251247#msg-251247

The results got even more fascinating as i increased the buffer size’s
to
the following.

client_max_body_size 0;
client_body_buffer_size 1000m;
mp4_buffer_size 700m;
mp4_max_buffer_size 1000m;

http://s633.photobucket.com/user/C0nw0nk/media/Untitled-6.png.html

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251186,251256#msg-251256

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs