This tech has been developed several times but ultimately CDNs are now so cheap that P2P is pointless. You can't ignore development cost since it dominates all other costs in this case.
If CDNs are so cheap, why is YouTube insistent that they should get paid for their bandwidth? I already pay for my bandwidth and am quite happy to use it for something like YouTube. The real reason is centralised architecture gives them control and ability to extract rent.
Ask HN: Why is there no P2P streaming protocol like BitTorrent?
221–230 of 231 posts
Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#222What does that mean?
The steps to live are pretty simple on the server side (assuming HLS):
1. Stream to your encoder, ideally at a bitrate higher than the transcoded bitrate.
2. Encode and transcode your video, ideally to 540/720/1080p 30fps. Each resolution will have its own bitrate, so maybe 2/3.5/5.5 respectively. Assume 2 second segments, and a manifest duration of 10 seconds. So you have 5 segments out there at any given time (though there are usually a few more hanging around).
3. Put the 3 newest segments to storage, and rewrite the four manifests with the new segment URLs. (do you need to rewrite the top-level manifest? I believe you do, but I can't remember).
4. Delete the older segment(s) (optional)
So when the client requests the manifest (the m3u8), it'll getch the three sub-manifests (forgot the term) and chose the appropriate resolution. It'll also start loading the segments up. Ideally it would look at the manifest and fetch the latest segment, so it starts nearer to "now."
Then the client will occasionally re-fetch the manifests to get the new segments (the manifest is marked as live; VoD manifests don't require reload). The fetch time probably must be All that takes time. It takes time for the server to encode, time for the encoder to put the file(s), time for the client to fetch the manifests, and time for the client to fetch a video segment.
Looking at the above sequence, a client can be generally 0-10 seconds behind everyone else, depending on how the client behaves. And that's a few seconds behind "live," because receiving, encoding and putting files takes time.
So can you do p2p live? As long as you relax the constraints on what you mean by "live," yes. As you can imagine, the chain of latenty keeps growing longer the more peers a segment goes through. And that segment is only really good for 2 seconds (or up to 10 seconds, if the client is sloppy). If live means "up to 20 seconds since now" then yes, you can definitely do it. The tighter that time window gets the less likely you'll be able to do it. You might be able to do it with a lower bandwidth stream, but even TLS negotiation takes time. Does your client not use TLS? That will save you time.
Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#223Earlier quoted context omitted.
This comments on why bittorrent as is isn't used for live streaming, not why P2P shouldn't be used for live streaming > Latency matters. In bit torrent if the peer goes away, no big deal, just try again in 5 minutes with another peer, you are downloading in random order, who cares if one piecs is delayed 5 minutes. In a live stream your app is broken if it cuts out for 5 minutes. First of all, BitTorrent clients do n…
I have a relatively slow ADSL connection, it's not unusual for me to be able to download 100% of the file at say 95% the theoretical rate without uploading anything. If the network has enough upload capacity to do this, does it really need my upload? (Note my client is still there if somebody needs a rare block) I remember some Bittorrent networks circa 2005 or so which tried to monitor you and punish you for not con…
But personally I believe you're not obliged to anything in torrents, especially with adsl. We got you covered with our multi-hundred u/d ratios. Everyone participating honestly and comfortably is enough, even if that means no upload. Just don't turn it off out of unnecessary principle after downloading.
Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#224Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#225Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#226Earlier quoted context omitted.
For pseudo-live streams such as sports events, that would be totally fine. People can have slightly out of sync streams, delayed by various amounts. But you can't live stream a conversation with someone if you have a 10s delay.
Latency is actually a pretty big deal for live sports events. No one wants to hear the cheering start at the neighbor's house ten seconds before you get to see the team score a goal.
Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#227I think your other constraints (tree topology & connection prioritization) already describe how BitTorrent works.
I think there's one thing you'd need to change for /live/ streaming, where the file is actually being created /during/ broadcast-- I think the file verification hash systems require the seeder to have the entire file when initially seeding. I think magnet links and .torrent files are based on a hash of the entire file. Do maybe you need some kind of modification to DHT , .torrent , .magnet , to support verification by sequential chunks.
Re: Ask HN: Why is there no P2P streaming protocol like BitTorrent?
#228There was Joost in 2008, from Skype founders. Skype was originally P2P until Microsoft acquisition and killing this legally questionable feature - need to feed the big brother (: Joost raised ~$50M. I remember it as it was one of rare apps built in XUL, the same framework as Mozilla apps (Firefox). https://en.m.wikipedia.org/wiki/Joost