My nginx server is buffering all data POSTed by client, and when it has all data, it writes the data to fastcgi socket. How can we avoid that delay, and let fastcgi start receiving the data bit-by-bit, as soon as it's received from client ? I tried to play with fastcgi settings but no luck. Thanks
Asked
Active
Viewed 3,114 times
1 Answers
1
as far as I know this is not possible
1) client_body_buffer_size is the directive which handles the client request buffer size. This is used to handle POST data, meaning form submissions, file uploads etc.
http://wiki.nginx.org/HttpCoreModule#client_body_buffer_size
if the request body size is more than the buffer size, then the entire (or partial) request body is written into a temporary file.
2) Buffering can't be disabled for fastcgi. Maxim Dounin explained that in details here http://www.ruby-forum.com/topic/197216

hostmaster
- 553
- 2
- 6
-
But the link you gave is talking about the data transmission FROM fastcgi backend TO the client. My problem is that the data sent FROM the client TO fastcgi THROUGH nginx is buffered. My app is handling file uploads and I need to display a progress bar, that's why I must receive the data as soon as the client sends it. – Antares Aug 24 '12 at 15:28
-
I agree. but first link mentioned that this is true in both directions. – hostmaster Aug 24 '12 at 15:54
-
I recommend letting Nginx do its job and buffer the entire request body before calling the backend service. This has the advantage that slow uploaders don't take up any resources in your backend, until the request is ready to be processed. If you need upload progress, you can have Nginx provide such info, using this: http://wiki.nginx.org/HttpUploadProgressModule – Tobia Oct 29 '13 at 16:15