HaLo2FrEeEk Posted June 28, 2007 Share Posted June 28, 2007 Hey everyone. I created a Bandwidth load balancer using my database so that I could serve large files, and have other people host them too, this way no one host gets hit too hard and the bandwidth is shared evenly. I'm sharing movies, so basically, it uses this little script: <?php mysql_connect($host, $user, $pass) or die($host_die.mysql_error()); mysql_select_db($dbname) or die($db_die.mysql_error()); if($_REQUEST['id']) { $link_id = $_REQUEST['id']; } else { die("No Link ID Detected."); } $query = mysql_query("SELECT * FROM `distrib` WHERE `link_id` = ".$link_id." AND `bandwidth` = (SELECT MIN(`bandwidth`) FROM `distrib` WHERE `link_id` = ".$link_id.")"); $info = mysql_fetch_assoc($query); $url_id = $info['url_id']; $url = $info['url']; $query = "UPDATE `distrib` SET `bandwidth` = `bandwidth`+`filesize` WHERE `link_id` = ".$link_id." AND `url_id` = ".$url_id; mysql_query($query); header("Location: ".$url); ?> and opens the link which has had the least amount of bandwidth usage so far. The only thing I don't like about it is that when the movie opens in Windows Media Player it shows that the url is http://claninfectionist.com/movies/distrib.php?id=[whatever id], and not the actual URL of the movie, how can I do the redirect so that it shows the URL in Windows Media Player as the actual url of the movie file, and not the load balancer page, becuase I think, since it is showing that link, that that page is acting as a proxy, siphoning off my bandwidth, which I'm trying to avoid with this script. Quick help will be appreciated. Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted June 28, 2007 Author Share Posted June 28, 2007 Bump, sorry. I really need this answered. I'm releasing a new movie tonight and it's quite large. Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 28, 2007 Share Posted June 28, 2007 mod_rewrite http://forums.digitalpoint.com/showthread.php?t=1556 hope this helps ok. Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted June 28, 2007 Author Share Posted June 28, 2007 That's not what I need, I need it so it is not using my distributor as a proxy and just passing me along to the real url, it seems like it's using distrib.php as a passthrough which will eat up my bandwidth. Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 28, 2007 Share Posted June 28, 2007 1 min are all the movies running from someone else and not you? or are you showing the movies via your own server? Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted June 28, 2007 Author Share Posted June 28, 2007 I currently have two links, one from my server, one from a remote server, the link is: http://claninfectionist.com/movies/distrib.php?id=1 sometimes it says the movie url as the url in WMP, and sometimes it shows this distrib.php url, making me think it's still using my bandwidth. Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 28, 2007 Share Posted June 28, 2007 nice film but the problam is your streaming media and the bandwidth will be bad no matter what. when i run a internet radio station i spent money to get my bandwidth others also showed films i used winamp and i think you also need to go there and see what the cheapest way to get your video's streemed. i am sorry but you need a media streamming dedecated sever with high bandwidh unfortuntly it cost's. Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted June 28, 2007 Author Share Posted June 28, 2007 I have 2.5 terrabytes of bandwidth, I'm not worried I'm gonna go over, the only thing I'm worried about is keeping the bandwidth even between multiple mirrors, so THEY don't get hit too hard. And it's not streaming, it's going over the hypertext transfer protocol, http. Streaming media goes through a streaming protocol such as rtsp (realtime) mms (microsoft media) and the like. Like I said, I don't really care about MY bandwidth, it's theirs I'm worried about and I want to make sure THEY don't get messed up. btw, thank you for the comment on the vid, I appreciate it. We've been in production with that movie since February, and we FINALLY got it done. Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 28, 2007 Share Posted June 28, 2007 ok then m8. the buffer rate takes ages why then i got a 60 meg line but that fast for a home user as you no so why it so slow to buffer. maybe you can use a compression softwere to cut file size of the films down. Quote Link to comment Share on other sites More sharing options...
HaLo2FrEeEk Posted June 28, 2007 Author Share Posted June 28, 2007 It's becuase I posted the links on like, 5 different sites, so it's bogging the server down. I could use a compression prog, but I don't want to, becuase then I get lossy quality, I'm actually proud of how good my quality turned out in this movie. If you're a Halo fan, consider joining up on my forums, http://claninfectionist.com. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.