Welcome! Log In Create A New Profile

Advanced

Re: How do proxy_module response buffering options work?

Maxim Dounin
November 18, 2011 09:02AM
Hello!

On Thu, Nov 17, 2011 at 09:52:57PM -0500, liuzhida wrote:

> > Additionally, there is proxy_max_temp_file_size,
> > which controls how
> > much data may be written to disk. Once temp file
> > size becomes
> > bigger - nginx pauses reading data from upstream
> > until data from
> > temporary file is sent to client.
>
> do you mean if a response size is larger than all the proxy buffers,
> after some part of the response been written into buffers, the rest of
> data which can't be written into buffers will be written into temp_file?

Yes, as long as it's not possible to write data to client fast
enough.

> for every single response? the proxy_max_temp_file_size are global or
> per request?

Per request. It limits maximum size of a temporary file used to
buffer a request.

> for example the upstream response is 2000 bytes. Nginx is configured
> with 4 buffers, each 100 bytes in size. is that nginx deal with this
> single response with written the 400 bytes of response into buffer and
> written the 1600 bytes into temp_file?

Roughly yes. (There are some nuances though, as you can't write
data to file without using in-memory buffers, and that's why some
memory buffers will be reserved for reading response from upstream
and writing it to disk. And again, this all assumes it's not
possible to write anything to client, while 2000 bytes usually
just fit into socket buffer and will be passed to kernel
immediately even if client isn't reading at all.)

> and after the buffer is
> completely send, Nginx will read the rest of response data from the
> temp_file and written into buffer?

It will follow usual procedure to send file-backed data (the same
one which is used for static files), i.e either it will use
sendfile() or read data to output_buffers and send them.

Maxim Dounin

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

How do proxy_module response buffering options work?

Hongli Lai April 24, 2011 10:50AM

Re: How do proxy_module response buffering options work?

Maxim Dounin April 24, 2011 05:24PM

Re: How do proxy_module response buffering options work?

Hongli Lai April 24, 2011 06:08PM

Re: How do proxy_module response buffering options work?

Maxim Dounin April 24, 2011 06:16PM

Re: How do proxy_module response buffering options work?

Hongli Lai April 25, 2011 08:16AM

Re: How do proxy_module response buffering options work?

Maxim Dounin April 25, 2011 02:54PM

Re: How do proxy_module response buffering options work?

liuzhida November 17, 2011 09:52PM

Re: How do proxy_module response buffering options work?

Maxim Dounin November 18, 2011 09:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready