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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.