This is a question that comes to mind every time I spend a few days focusing on the fediverse. Normally I’m on the microblogging side, but now I have a Lemmy account it might start a proper discussion.
So, to the point, pretty much every fedi platform has similar problems with small servers taking a beating whenever a post goes viral. This ends up costing the server owner a bunch of money trying to keep their server alive while thousands of instances attempt to pull large static files from the original host’s post. This recently instigated this call to action on this forum.
I’ve never seen the question of torrents answered and it feels like a lot of effort and a bit self entitled to get the ear of fedi software devs to implement torrents as a solution, so I’m putting this here.
If media files were made into torrents when a post was being created, an extra object could be added to post objects like
'torrentcdn': {
'https://imagePathAsKey.jpg': {
'infohash': 'ba618eab...',
'torrentLocation': 'https://directlinkto.torrent',
'webseed': 'https://imagePathAsKey.jpg',
...
}
}
This would not break compatibility as it would just be ignored by anything not looking for a ‘torrentcdn’ object, yet up to date instances could use this instead of directly pulling the static files.
This would benefit instances as when a post goes viral, the load would be distributed amongst all instances attempting to download the file.
This could also benefit clients and instances as larger files like short videos could be distributed using webtorrent, massively reducing the load on server when many people are watching the same video.
Thoughts?
Additional suggestion - using magnet links wouldn’t even require torrent files
https://github.com/webtorrent/magnet-uri
I’ve just been reading up on that. Apparently a magnet link won’t work without at least one proper seed, as it still needs to download the torrent file from somewhere. https://github.com/webtorrent/webtorrent/issues/1393#issuecomment-389805621
A torrent link won’t either? In either situation, the site needs to seed their own data, at a minimum.
A torrent file and a webseed is enough. The client uses the torrent file to validate the download from a standard http source.
The webseed can be the same source as the file your browser would normally download.
So yeah the site needs to seed the file, but not necessarily using a torrent client.