Help with nginx proxy store as a frontend MP4 Anycast CDN

Greg M gregm at servu.net.au
Thu May 2 07:12:02 UTC 2013


Hi,

I have been reading up on the nginx documentation and also stackoverflow about creating an Anycast CDN based on nginx-frontends.

We currently use nginx on the backend, and Squid for caching images and mp4's - however Squid is incredibly difficult to cache the mp4's as it cant handle the moov atom's, and thus is always just proxying direct from our servers.

We've read that an nginx proxy "store" can actually store content locally - but how is that store defined and managed ?

For example, we have 6 CDN endpoints around the world, each with 200G of SSD space, so ideally we'd like nginx to cache around 50-70G of videos (out of a total of 1.2TB on the backend). Here is our basic config:

server {
        listen x.x.x.x:80;
        server_name  cdn.blah.com;

  location ~ \.mp4$ {
    mp4;
    proxy_pass http://origin;
        proxy_store /cache/videocdn/$request_uri;
        proxy_store_access user:rw group:rw all:r;
        proxy_temp_path /cache/nginx;

  }
}

The first question I have is - how do we limit how much this above configuration will hold ? Do we need to manually run a bash script that checks for old mp4's based on access time and purge ?

The final question is, how can we have all requests to initially check the local cache for content ? In the same way on this request was asked http://forum.nginx.org/read.php?2,11284,11284 Maxim advised its possible to return "X-Accel-Redirect" to the file in the store. We would also want this for in-progress caching attempts, for example if I requested cdn.blah.com/1.mp4 on a 2nd machine, before the first machine's request for the same file has had a chance to fully cache in the store.

Thanks in advance for any assistance!

Regards,

Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130502/8038ebaf/attachment.html>


More information about the nginx mailing list