Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upusing webtorrent as a cdn for pictures? #260
Comments
This comment has been minimized.
This comment has been minimized.
|
WebTorrent (in the browser) could certainly be adapted to serve that use-case. The tradeoffs are a bit different, though. PeerCDN optimized for low-latency downloads and fast peer discovery. This meant the client and site owner had to trust PeerCDN servers to serve correct piece hashes for content (there was no notion of a .torrent file with piece hashes). WebTorrent requires no trust of a centralized server, other than the server serving the script (true of all web apps). After that, the WebTorrent client verifies all file content like a normal torrent client, with all the normal guarantees. PeerCDN also used "trickle ice candidates" for faster connection establishment. WebTorrent currently disables trickle ice to lessen the load on WebTorrent tracker servers by sending fewer messages. WebTorrent also wants to support a DHT at some point, to eliminate reliance on trackers. WebTorrent will definitely be slower than a CDN for serving 200KB image files. For files that small, latency is all that matters. Torrent downloads usually do better for larger files, where overall download speed trumps latency. |
This comment has been minimized.
This comment has been minimized.
|
too bad, that would have been fun |
This comment has been minimized.
This comment has been minimized.
|
i imagine you could set this up if you have large pictures so the thumbnale is serverd via a cdn, and the full res enlarged image via webtorrent |
This comment has been minimized.
This comment has been minimized.
|
@glasspelican Yep. Another trick we used in PeerCDN is to load images that are above the fold via the origin server, and load the rest via peer-to-peer. Users usually don't (or can't) scroll down the page for a few seconds while the page is loading, which is enough time for the P2P connections to get set up :) |
This comment has been minimized.
This comment has been minimized.
|
Hi Feross, |
This comment has been minimized.
This comment has been minimized.
|
@feross just in case distributing pictures this way was becoming acceptable performance-wise, I was considering naming my pictures using the same infoHash those picture would get from webtorrent (I want to rename them from a hash anyway to avoid duplicates), but hashes I get from |
Does it make sense to think of webtorrent as a possible cdn à la PeerCDN? What would be the pros and cons of distributing 200ko pictures this way? Especially, what's the cost of DHT lookups compared to DNS?
thanks for this awesome project :)