Chris Kranky

Recent Posts


WebTorrent: Rethinking delivery

P2P rethinks the entire client-server model, a 25 year old tradition though is hard to break.

Chris KoehnckeChris Koehncke

blankAt last week’s hastily arrange WebRTC meet-up hosted by Twilio (thanks to Justin Uberti and Sam Dutton of Google for speaking), Feross Aboukhadijeh and John Hiesey agreed to demo their latest work on WebTorrent. San Francisco developers are well accustomed to hearing and discussing the latest and greatest technology. Thus I started to pay attention (which I rarely do) as the assembled group of developers leaned forward in their chairs while mouthing, “you did what?” as Feross talked about the power of WebTorrent.

Feross’s demo started with no bang, no sizzle, no fancy CSS – it was a simple URL and nothing more than a blank page. He opened another tab to the same URL. Same blank page. Even by developer standards this was dull. On one tab, Feross clicked and drew a circle. The drawn circle immediately started to appear on the other browser tab. Polite applause from the audience as they silently thought to themselves that a Stanford education wasn’t buying as much as it used to. Nice, but this has been done before.

Feross then became to explain what was going on behind the scenes. It was at that point even I stopped chomping on my free pizza slice and moved in closer.

Basically, Feross (and his mighty team of open source contributors) have married the WebRTC data channel to BitTorrent. When you opened the page, the JavaScript that they wrote started an “on the fly” torrent. This torrent “discovered” others who had the same tab open and they immediately displayed whatever was shared. You could draw simultaneously in each tab window and each person’s hieroglyphics would show up on all screens. All of this within the web browser (there is no central server involved).

network

WebRTC is a P2P mesh by design. This means that each peer requires it’s own connection to the other side. If you have 3 people trying to communicate (say the classic, tired and extremely boring WebRTC video talking heads demo), each peer would have to maintain a connection to 2 other peers. That works fine for small scale, but as you increase the size of the group, the connections required expand. On video, for example, we’ve all seen that WebRTC typically starts to struggle above 3 connected peers and even the most powerful machines starts to grind to a halt beyond that. Clearly the video bandwidth is one issue, but the connection management is equally hard.

BitTorrent has a bad reputation because users frequently use it  to illegally trade music, and that put a dark cloud over it.  That’s the official story. The unofficial story is that most developers simply don’t understand it. Why? Because it’s hard.  Terms like seeds, swarms, local peer discovery, distributed hash tables, leechers, trackers are not in the everyday vocabulary of a typical developer. The nature of BitTorrent is more for someone who loves mathematical problems than someone who gets excited about round CSS boxes (it’s all about the drop shadow I’ve been told).

Ok so we drew a box on the screen and it appears on another screen, fantastic technology, but what’s the big deal? The big deal is that it’s a big deal in terms of scale. Let’s think about a typical big box screen sharing application. These companies have monster data centers where servers sit waiting to update the hapless souls being inflicted with the pain from your latest PowerPoint incarnation. These cost money and the complexity grows as you try to update thousands of screens simultaneously. With WebTorrent the power of the swarm (all the other connected users) is leveraged to convey the data. This would be a huge cost savings, not to mention it’s simpler.

Feross wasn’t finished though. He stepped up and dragged a video file onto the blank canvas (I’m sure he used rounded CSS boxes), magically, the other screen immediately started to stream the video. The audience gasped, at this point I managed to get another free pizza slice.

You could quickly imagine a heavy video content provider utilizing WebTorrent to reduce their bandwidth & server expenses. “Yeah, Kranky dream on, this streaming only works if multiple people are trying to watch the same video at the same time, how often does that happen.” I’d argue some points here, but the real use of WebTorrent would be within the content providers infrastructure to sharply reduce all of their internal complexity in streaming thousands of connections. You could imagine Netflix salivating at the prospect of being able to effortlessly scale larger and at reduced price point. Technology like that would be worth tens of millions to them in just savings.

“Oh Kranky, you do have a vivid imagination, what color are the skies on your planet?”

You think, here’s a current job listing at Netflix  looking for a Senior Software Engineer whose contributed to to, you guessed it, WebTorrent.

Please note I am the exclusive listing agent for Feross in the Los Gatos area. 😉

So What?

WebTorrent has significant business potential to radically change the traditional notion of client-server with applications for internal infrastructure and external closed user communications. WebTorrent has moved from an “idea” to a science experiment to now on the edge of being viable. It’s early, interesting and of note, promising.

Further clicking:

Try the whiteboard feature yourself (prepared to be underwhelmed)
Stream a movie using BitTorrrent & WebRTC
Learn more about WebTorrent
A server within a browser using WebRTC