Welcome! Log In Create A New Profile

Advanced

proxy_store and multiple requests for same file

Posted by peter_kaas 
proxy_store and multiple requests for same file
August 26, 2009 04:06AM
We are using proxy_store to run several mirrors on demand. Our content consists of large files (500 Mb) which --because of the geographic location of our proxies-- may take a while to load from the backend servers.

When several users hit a file that is not mirrored yet at the same time, nginx will start a connection to the backend server for each of these requests. Causing an incremental slowdown as incoming bandwidth is being saturated.

The relevant part of our configuration looks like this:

location @fetch {
internal;

proxy_pass http://backend.server.com;
proxy_set_header Accept-Encoding "";
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_intercept_errors on;
proxy_buffering on;

root /var/cache/nginx/frontend.server.com;
}

Is there any way in which we can make nginx use one connection to the backend per file? (preferably sharing it when several users request it such that all users already get the data as it is coming in...)

regards,

Peter.
Re: proxy_store and multiple requests for same file
August 28, 2012 12:17PM
Sorry to resurrect this old thread.

I was wondering if there is any remedy for this stampede problem.
It would have been nice if proxy_store works in the same manner as proxy_cache. (using just one connection to backend for multiple client connections)

The problem is that mod_h264 doesn't work with proxy_cache, hence the need to use proxy_store.
Re: proxy_store and multiple requests for same file
August 28, 2012 12:25PM
One idea is that you can put a caching proxy in front of proxy_store.
This way, a proper caching proxy will not stampede the backend.

However, there's still a heavy disk io problem as each nginx->caching proxy
connection means a file being written to disk.

Basically with this setup, you can prevent network, but not disk io stampede.
(Disabling mod_h264 won't work either as the file needs to be stored locally to be seek-able.)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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