Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a distributed application that consists in a main CMS server where "human" users can upload videos, pictures (media content, basically) and a bunch of "players" that play those videos or pictures at certain times.

Right now, each and every player connects via HTTP/SFTP to the CMS to grab the content it needs to play (erm... and plays it... if nothing is broken). It won't connect to the CMS again if the player has already downloaded the video it needs to play. I mean... is not that the CMS is streaming the videos or anything fancy like that... the player says "Oh, I need to play the video Jenna_Jameson_meets_the_plumber.avi (to say something) in 5 minutes. Do I have it already?" If yes, just play it when it should. Otherwise, connect to the CMS, download it and play it when it should. The players act more like a "cache" for the media to display.

Now, there's a chance that a big number of those players are in the same private LAN, connected among themselves with a fast Ethernet connection (Much faster than the cheapy-weepy DSL connection that they may have with the CMS) So I was considering to implement something so the Players request the content from their neighbors before going to the CMS (both Players and CMS are coded in Python and use Ubuntu as O.S.) but then I thought that maybe there's something like that in place (and I that I could do it using pre-existing tools which I trust way more than anything I could implement myself). Does any of you know something that may work the way I want? One of the issues is that I'm not even too sure how to call that kind of application.

I've taken a look to NFS file systems, but then (if I understood correctly) I would need to mount one NFS directory per "other" player, and every time I need one of those educational documentaries I want to play, I would need to traverse all those NFS directories, check if the video is in any of them and if not, go grab it from the CMS... That sounds a bit slow, right? Also, I don't know how to handle very well that the computers in the LAN may not be my players. I don't know how could I handle with a distributed filesystem the discovery of "my" players.

If anyone could point me in the right direction, I'd appreciate it. Thank you in advance.

share|improve this question
2  
This sounds like a job for bittorrent. –  bahamat Aug 3 '12 at 19:42
    
hmmmm... interesting... I hadn't thought about bittorrent... You're not saying that because of the name of the video I used to exemplify, right? (I know bittorrent is widely used to get that kind of... of... documentaries...) :-D Thanks though, I'll have to take a look to bittorrent capabilites –  BorrajaX Aug 3 '12 at 19:46
    
@bahamat I read "so the Players request the content from their neighbors" and thought the same thing. +1 –  Tim Aug 3 '12 at 20:53

2 Answers 2

up vote 3 down vote accepted

Well, I suppose it should be an answer then.

This sounds like a job for bittorrent.

share|improve this answer
    
Thanks, @bahamat. I'll try to setup the bittorrent network thingy... I'll take me a while, but if it works, I'll accept your answer :) Thanks again –  BorrajaX Aug 3 '12 at 22:21

Maybe you can use a proxy in your lan?

I mean, setup some local proxy that will cache the media content such as images and videos.

Then the first time some of the "players" wants to "play", your proxy will cache the file and when the next player wants to play, it will have to settle with the file that was already used.

You could probably even set the players to only fetch media files via proxy, and have the rest go directly to your CMS.

I thought of the idea because I was seting up varnish (server side) to cache images and stuff few days ago, but if you know a bit of history, you'll remember that the ISPs were all proxying stuff back in the day.

share|improve this answer
    
Yeah, but then I have to configure the proxy manually and it's a bit annoying (and I'm very lazy) :D It's something to keep in mind, though! –  BorrajaX Aug 16 '12 at 15:47
    
It's not much different then setting up torrent - also manually. And with proxies - you have a lot of ready-made appliances with simple gui - just tell them what to cache, for whom and that's it. –  Zlatko Aug 18 '12 at 9:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.