What type of hardware are you using: VPS bought online What YunoHost version are you running: latest What app is this about: PeerTube
Describe your issue
In a few days I will publish a video on my PeerTube that may end up having hundreds of concurrent viewers. I’ve been checking out PeerTube’s documentation to see what advice they offer and they write:
Forbid access to /api/v1/videos/{videoID}/views and /api/v1/metrics/playback in your reverse proxy so PeerTube does not handle these API calls (you’ll loose views and viewers statistics)
Is there a way to do it with YunoHost?
Or do you have recommendations about settings to tweak to avoid issues?
Disclaimer: the information I am about to give is not 100% sure, I am definitely not an expert.
One of the most awesome features of PeerTube, from which it also gets the name, is that if multiple people watch the same video, those viewers also upload to others the bits of video they have already downloaded. Therefore, if many people are streaming the video at the same time, it becomes a bit like bitTorrent: many peers downloading the video from multiple sources and uploading it to others, too. You can notice this is happening because when you watch any video on PeerTube you can see in the bottom-right corner the download and upload speed metrics and the number of peers:
In this way, the load on the server is automatically reduced because the video is not streamed from one source only, and you don’t have to worry about server load (in this particular case only, in general we definitely should worry about server load and this is something I am trying to understand myself)
Ciao Tommi! Thank you for the answer.
My biggest worry is thousands of Mastodon servers trying to fetch the video’s preview image and attempting to stream the beginning natively inside Mastodon. The infamous “Mastodon Hug of Death” that already took out my VPS when I launched my self-hosted Ghost blog. But I think I found a solution! Because my VPS now has rock solid caching in place thanks to Varnish cache, I will publish the video as unlisted and embed it on a blog post (on my Ghost blog)… so that Mastodon will fetch the cover image of the blog post and the traffic won’t be so severe. I will trust PeerTube’s P2P function to take care of the rest.
I hope that solution will work nicely
If it does not, one way would be to block (in nginx) Mastodon bot from getting any content from the server, which will break the preview for sure, but also prevent your server from getting such high load all of a sudden.
Thank you for the reply Lapineige. I’m curious to see if my “mitigation plan” will work… basically this way nobody will have the URL of the PeerTube video, so even if accounts with very large followings share the link, it will be to my Ghost blog (and not PeerTube).
Let’s see.
Now if I wanted to block the Mastodon bot via Nginx, which steps would I have to follow? If you have a guide for that, I’m all ears
I’m not sure, and I can’t give you the whole process, but what I think is that the Mastodon “bot” as a specific user agent and can be blocked thanks to that (either in robots.txt or via Nginx) but I can’t tell exactly how from memory.