Jump to content

Bandwidth Load Balancer, one little problem


HaLo2FrEeEk

Recommended Posts

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.

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.

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.

 

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.