Welcome! Log In Create A New Profile

Advanced

Re: Disable memory buffer for file uploads

Francis Daly
March 23, 2011 06:18AM
On Wed, Mar 23, 2011 at 11:43:08AM +0800, Space Lee wrote:

Hi there,

> I have a question, will write to the disk much more slower than using memory?

Usually, yes.

But the full sequence is more like "read from network", "write to buffer",
"read from buffer", "write to fastcgi server or http server or whatever
nginx sends the request to".

Will the write to disk (buffer) be much slower than the read from network?

If you have enough memory (and a good OS disk cache), the "read from
buffer" may effectively be "from memory" anyway.

> So my question is :
> when users upload large files, should I use large memory for client_body_buffer_size or little memory.
> when users upload small files, should i use large memory for client_body_buffer_size or little memory.

How much time will it take for your user to complete the upload http
request, for nginx to buffer it, pass it on, and to have it processed
by whatever nginx passes it on to?

In that time, how many other user upload-requests will start? (= N)

And how much total real memory do you want to use for upload-request
buffers? (= M)

M/N is a rough guide to the size you want for client_body_buffer_size. You
don't want your upload-request buffers to push the memory use above the
real memory available.

> And in this situation, when he finishes uploading, will the content be remove when the memory for client_body_buffer_size is full, and so that new uploaded files could use the memory.

The buffer will eventually be released. From a capacity point of view, expect
it not to be released until the http connection is closed by the server.

(Exactly when it is released is less important -- for capacity planning,
assume the worst :-)

All the best,

f
--
Francis Daly francis@daoine.org

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

Disable memory buffer for file uploads

akaris March 22, 2011 08:17PM

Re: Disable memory buffer for file uploads

Francis Daly March 22, 2011 11:40PM

Re: Disable memory buffer for file uploads

fjctlzy March 22, 2011 11:44PM

Re: Disable memory buffer for file uploads

Francis Daly March 23, 2011 06:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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