Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using webtorrent as a cdn for pictures? #260

Closed
maxlath opened this issue Feb 6, 2015 · 6 comments
Closed

using webtorrent as a cdn for pictures? #260

maxlath opened this issue Feb 6, 2015 · 6 comments

Comments

@maxlath
Copy link

@maxlath maxlath commented Feb 6, 2015

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 :)

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Feb 7, 2015

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.

@maxlath

This comment has been minimized.

Copy link
Author

@maxlath maxlath commented Feb 7, 2015

too bad, that would have been fun
thanks for the answer!

@maxlath maxlath closed this Feb 7, 2015
@glasspelican

This comment has been minimized.

Copy link

@glasspelican glasspelican commented Feb 8, 2015

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

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Feb 9, 2015

@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 :)

@abramjs

This comment has been minimized.

Copy link

@abramjs abramjs commented Feb 24, 2015

Hi Feross,
and thanks to share your software. I'm fascinated by webtorrent, but I'm also interested to PeerCDN. I haven't found any news about PeerCDN since you were acquired by Yahoo. Is the project shut down?
thanks again

@maxlath

This comment has been minimized.

Copy link
Author

@maxlath maxlath commented Mar 14, 2015

@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 simple-sha1 (either from the raw buffer or the utf-8 forms) and the one returned by instant.io when I pass the same file don't match: is there a file modification I might have missed? In the eventuality this approach makes sense, what would be a good practice to prevent timestamps and other metadata to break the hash match between 2 files uploads?

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.