That's not a bad solution but, as you know, when you flip a coin, it's possible to get 75 heads in a row.
If you use this method and you start to see one server overloaded, you won't know if it's because there is something wrong with that server - or if it's because the random number generator has been sending too many downloads its way.
A better way to do it is to know for sure which box is next. Since you want 35%, 35%, 30%, that's the same as a 7 : 7 : 6 ratio. In other words, Server #1 gets 7 hits, Server #2 gets 7 hits and then server #3 gets 6 hits.
So I would probably do something like this:
Write the number "0" to a table in a database. Everytime you have to make a download link, do this:
- lock the table
- read the number from the database into a variable called $next_server.
- $y = $next_server + 1;
- if ($y==20) { $y=0; }
- write $y back to the database
- unlock the table
Now you have $next_server which represents the next server that should be used. So set up an array like this:
$a = array(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2);
$link = "http://www" . $a[$next_server] . ".yourdomain.com/files/music.mp3";
(this assumes that your servers are called www1.yourdomain.com, www2, and www3). You could also set $link like this:
if ($a[$next_server]==1) { $link = "http://www.happy.com/downloads/mp3/music.mp3"; }
if ($a[$next_server]==2) { $link = "http://www.golucky.com/mp3/music.mp3"; }
if ($a[$next_server]==3) { $link = "http://www.flippy.com/music_archive/music.mp3"; }
Notice that there are only 20 records in the array, That's 7+7+6 = 20.
This way, you will spread the downloads across the 3 servers in a 7:7:6 ratio