nginx caching proxy

Roman Arutyunyan arut at nginx.com
Wed Oct 17 11:24:47 UTC 2018


Hello,

On Wed, Oct 17, 2018 at 05:13:15AM -0400, drookie wrote:
> Hello, 
> 
> I did't find the answer in documentation, but am I right, assuming from my
> observation, that when the proxy_cache is enabled for a location, and the
> client requests the file that isn't in the cache yet, nginx starts
> transmitting this file only after it's fully received from the upstream ?
> Because I'm seeing the lags equal to the request_time from the upstream.

The short answer is no, nginx cache does not introduce any delays here.
Maybe your client waits until it receives the full file before letting you know.

When a client requests a file missing in the cache, then the file is requested
from the upstream and it is sent to the client SIMULTANEOUSLY with saving it
in the cache.  However if another client requests a file currently being
received and cached in the first client's context, and proxy_cache_lock is
enabled, then this second client will wait for the file to be fully cached by
nginx and only receives it from the cache after that.

[..]

-- 
Roman Arutyunyan


More information about the nginx mailing list