Welcome! Log In Create A New Profile

Advanced

Re: disable request body buffering for file upload

July 20, 2017 06:36AM
Hi Maxim,

> With "fastcgi_request_buffering off;" nginx will send the request
> body to the FastCGI application immediately, without trying to
> buffer it anywhere.

I have been monitoring the disk space while uploading a test file of 1.1 GB in size and have confirmed that with the fastcgi_request_buffering directive set to 'on' the disk space reduces by approximately 2.2 GB.

With the fastcgi_request_buffering directive set to 'off' the disk space reduces by approximately 1.1GB so it does look like the fastcgi_request_buffering directive is doing what it should however nginx still appears to cache the entire request body before it is proxied to fastcgi.

> It is up to your FastCGI application to handle this though,
> and PHP as well as PHP-FPM may impose additional limitations
> and/or require additional configuration for this to work.

I am still looking into PHP & php5-fpm configuration parameters in case this having an effect but it all feels like this cache is happening before the proxy.

From what i have researched so far it looks like nginx may always initially cache the entire request body in some form before the request is proxied.

Another approach we could take would be to add a disk space check api to our web app so we can confirm we have sufficient space before the upload POST call is made.

I appreciate that running a web server in a low disk space environment is not a common scenario however, in your opinion, should it be possible to get details of the upload POST request to a script before the entire request body is written to disk by nginx?

Many thanks
Gary
Subject Author Posted

disable request body buffering for file upload

garyc July 19, 2017 10:33AM

Re: disable request body buffering for file upload

Maxim Dounin July 19, 2017 11:00AM

Re: disable request body buffering for file upload

garyc July 19, 2017 11:22AM

Re: disable request body buffering for file upload

garyc July 20, 2017 06:36AM

Re: disable request body buffering for file upload

Maxim Dounin July 20, 2017 10:12AM

Re: disable request body buffering for file upload

garyc August 25, 2017 10:21AM

Re: disable request body buffering for file upload

garyc August 28, 2017 04:59AM

Re: disable request body buffering for file upload

c0nw0nk August 28, 2017 01:29PM

Re: disable request body buffering for file upload

garyc August 29, 2017 05:09AM

Re: disable request body buffering for file upload

garyc August 29, 2017 05:15AM

Re: disable request body buffering for file upload

Reinis Rozitis August 28, 2017 01:40PM

Re: disable request body buffering for file upload

Francis Daly July 20, 2017 05:12PM

Re: disable request body buffering for file upload

S.A.N July 21, 2017 04:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 324
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