Conversation
20e17d0 to
d277ae8
Compare
|
This sounds like a great idea, but I'm also a bit wary about changing these (supposedly carefully-selected) defaults. Maybe you can elaborate this a bit:
|
|
I will test this later. I posted this on the ML so see if people on their can comment on this. |
|
I revisited this PR today and read the ngx_http_proxy_module documentation in an attempt to understand how buffering works in nginx, and if these changes would indeed solve some issues without causing others. I've summarised things below; feel free to comment and point out any mistakes I might've made. Let's say that we have a typical reverse proxy setup with two connections:
Data can of course flow both ways, i.e. client -> proxy -> server and server -> proxy -> client. Now, if both connections are equally fast, then we can turn off buffering in order to speed things up a little. The proxy just passes HTTP packets on as soon as it receives them, which is obviously faster than holding them in a buffer for some time. In reality though, the connection between the client and the proxy will be slower than the connection between the proxy and the server. Let's say that we don't do any buffering at all. If the proxy streams a large blob towards the client, it will have to keep the connection to the server open until all HTTP packets have travelled from the server, through the proxy, to the client. The same is true for clients uploading large blobs. In other words, buffering is useful for freeing up back-end resources. If we keep An easy way to prevent buffer data from being written to disk is by setting The nginx documentation is a bit vague regarding whether options like I'll try to find some time for testing this in the next two weeks. @ypid, did you already do some testing yourself? |
d277ae8 to
be2c078
Compare
|
That is very detailed and a better read than the Nginx docs when I last checked them out. Just a small pointer, this PR is only about changing buffering for docker-registry. I am just mentioning that go avoid misunderstanding as you don’t mention docker-registry in your text. I tested a bit using proxy_max_temp_file_size 0;Does what the docs say: It only affects responses. So I am not sure how to do it. The small cache in RAM can stay if we can also disable caching to file for requests (docker pushes). On a more generic note, docker-registry should be perfectly capable of being run without reverse proxy, so I am not sure we really need the caching. I am using: proxy_request_buffering off;
proxy_max_temp_file_size 0;now. |
Feel free to test this change. What do you think if we turn of
proxy_bufferingin more roles? Specially for self hosting, you will not always have the fastest storage and I would argue that for applications handling bigger request bodies like docker-registry does, this Nginx default is bad.