Welcome! Log In Create A New Profile

Advanced

Re: Buffering issues with nginx

Valentin V. Bartenev
July 21, 2017 09:20AM
On Friday 21 July 2017 07:02:07 Dan34 wrote:
[..]
> I run nginx on 8080, for testing, since it's not suitable for live use on 80
> in my case and I'm trying to figure out how to fix it.
> And here's why I believe that there is a bug.
>
> In my case, I wrote test code on node side that serves some binary content.
> I can control speed at what node serves this content. On receiving end (on
> the other side of the planet) I use wget with --limite-rate. In the test
> that I'm trying to fix I send 5MB from nodejs at 20KB/s speed, client that
> requests that binary data reads it at 10KB/s. Obviously overall speed has to
> be 10KB/s as it's limited by the client that requests the data.
>
> What happens is that entire connection from nginx to node is closed after
> node sends all data to nginx. Basically in my test 5MB will take
> approximately 500s to deliver, but node gets tcp connection closed 255 s
> from start (when there is still 250 more seconds to go and 2.5MB is still
> stuck on nginx side). So, no matter what I do nginx totally breaks my
> scenario, it does not obey any configs and still buffers 2.5MB
>
[..]

No buffering doesn't mean no buffers used at all.

In your scenario there are at least 5 buffers involved, and 4 of them
are in OS kernel.

Here's the list:

1. Write socket buffer in kernel on node.js side where node.js
writes data.

2. Read socket buffer in kernel for node.js connection from what nginx
reads data.

3. Heap memory buffer to that nginx reads data from kernel socket buffer
(controlled by proxy_buffers and proxy_buffer_size directives).

No buffering here means that nginx doesn't keep that data in buffers
for some time, but writes it immediately to write socket buffer in kernel
for client connection.

4. Write socket buffer in kernel for client connection where nginx
writes data.

5. Read socket buffer in kernel for client connection from what wget
reads data.


wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Buffering issues with nginx

Dan34 July 17, 2017 02:06AM

Re: Buffering issues with nginx

Francis Daly July 17, 2017 05:16AM

Re: Buffering issues with nginx

Dan34 July 17, 2017 09:47PM

Re: Buffering issues with nginx

Francis Daly July 19, 2017 04:18PM

Re: Buffering issues with nginx

Dan34 July 21, 2017 07:02AM

Re: Buffering issues with nginx

Valentin V. Bartenev July 21, 2017 09:20AM

Re: Buffering issues with nginx

Dan34 July 21, 2017 01:45PM

Re: Buffering issues with nginx

Valentin V. Bartenev July 21, 2017 05:06PM

Re: Buffering issues with nginx

Dan34 July 22, 2017 02:00AM

Re: Buffering issues with nginx

Dan34 July 24, 2017 10:28AM

Re: Buffering issues with nginx

Dan34 July 24, 2017 12:24PM

Re: Buffering issues with nginx

Francis Daly July 24, 2017 03:06PM

Re: Buffering issues with nginx

Dan34 July 29, 2017 10:16PM

Re: Buffering issues with nginx

Dan34 July 29, 2017 10:41PM

Re: Buffering issues with nginx

Valentin V. Bartenev July 30, 2017 10:16AM

Re: Buffering issues with nginx

Dan34 July 30, 2017 02:03PM

Re: Buffering issues with nginx

Dan34 July 31, 2017 02:37AM

Re: Buffering issues with nginx

Igal @ Lucee.org July 19, 2017 04:22PM

Re: Buffering issues with nginx

Dan34 July 21, 2017 05:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 59
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready