request - help with streaming flash video through perlbal

Eric Lambrecht eml at guba.com
Sun Nov 25 18:29:17 UTC 2007


EJH Pollard wrote:
> In other words, an HTTP GET request to the perlbal server for
> www.example.com/999.flv?start=xxxx would be handled by 1) perlbal
> sends the 13 byte FLV header to the client, 2) perlbal does an HTTP
> GET request to s3.amazonaws.com/bucket-name/999.flv with a "Range:
> xxxx" header, and then streams the output from S3 to the client.  For
> extra bonus points, rate-limited to 35kbps, to save us some money on
> uncessary downloads of the whole FLV file (it plays out 33kbps, and we
> don't need to seek ahead and fill up the cache).
> 
> Is it possible to configure perlbal, patched as per
> http://lists.danga.com/pipermail/mogilefs/2007-April/000862.html, to
> behave in the manner described above?  If not, do you have any
> suggestions for what I should do to the patch/config to make it work
> like that?  We have a modest budget, and if it's a lot of work then I

Hi Etienne -
  I believe the patch I submitted will do what you want, but you're 
missing one component.

In your email the perlbal server recognizes the '?start=xxx' request 
parameters, makes a modified response to the S3 storage server, and 
proxies the file out to the client.

My patch doesn't put any smarts into perlbal - it assumes that you've 
got another web server that is interpreting the incoming request, 
mapping it to a location in S3 (or mogile), and telling perlbal where to 
get that final file and to also include that magic 13 byte header.

To make things work with my patch, you need to first set up perlbal to 
reproxy all requests to some webserver you've got running on the same 
machine.

Then let's assume your requests for flash files all look like this:

	GET /play?id=123123&start=5675675

Where 'id' is the id of the flash file, and 'start' is the byte offset 
for the FLV file.

The '/play' cgi script on your webserver should map the value of 'id' to 
the location of your flash file in S3 (lets say that is 
's3.amazon.com/123123'), and send these headers back to perlbal:

	X-REPROXY-URL: http://s3.amazon.com/123123
	X-REPROXY-FLV-START: 5675675

perlbal will then close the connection to the webserver, open a 
connection to S3, jump to byte offset 5675675, send the 13 byte magic 
header to the client, then send the remainder of the flv file to the client.

So the only real development you need to do is to create that cgi script 
that generates those headers, which should be pretty easy.

Eric...



More information about the mogilefs mailing list