I’m trying to set up redundant origin servers for a CDN that will deliver on demand video files. The current setup is that I have two “media” servers that have a large storage capacity and are running nginx. In front of those two servers is another nginx server that is setup as a reverse proxy, splitting requests to each of them.
Duplicates copies of each video are stored on each media server. They are copied to each media server but may occur at slightly different times. Because of that, nginx will return slightly different LastModified headers for requests for the videos, depending on which nginx server served it.
The problem is, the CDN that caches the data will sometimes send IMS (If Modified Since) requests to the origin server, and will use that information to determine if it needs to refresh the video in its cache. The CDN makes byte range requests for the videos, which could easily be split between the two servers. If the byte range requests continue to get different last modified headers, everything gets screwed up.
Is this a solvable problem? Do I need to use some other mechanism for keeping the data between the two servers “in sync”? Maybe I can use rsync to copy the data from one storage server to the other, and pass in an option that preserves all the creation/modified times?
You’re just copying the files? Any program you use for copying will have some way of also copying the timestamps, so that they will be identical for both copies.
For instance, using the GNU
cp program on Linux:
cp --preserve=timestamps source destination
Of course, since this is the default behavior…check the documentation for whatever you’re using to copy the files.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.