Forum Moderators: coopster

Message Too Old, No Replies

mirroring a video file

         

u4eas

1:01 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



We have a video file on our site that we are going to mirror on two other servers. What we want to do is have the website pull from one of the three servers in a cycle pattern each time the file is called up.

example:.

visitor 1 calls up the movie which plays from Mirror 1
visitor 2 calls up the movie which plays from Mirror 2
visitor 3 calls up the movie which plays from Mirror 3
then repeat

this way we don't blow through all of our bandwidth on server #1

we obviously want to make it so it appears seamlessly to the visitor. We also don't want them to have to select from a set of mirrors.

Anyone have any ideas? We are running php/apache/mysql

Thanks in advance...

jatar_k

3:04 pm on Oct 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you will need a way to know which was the last server used and then use the next one.

get your last value from wherever it is stored, then

switch ($counter) {
case 1:
$url = 'server1.com';
$counter = 2;
break;
case 2:
$url = 'server2.com';
$counter = 3;
break;
case 3:
$url = 'server3.com';
$counter = 1;
break;
}

then write the resulting value of $counter back to wherever you are storing it