How to reduce CPU and plunger usage?
if there is a way to reduce cpu and ram usage somehow
Not really: you just need to stream the video through (using fread()
in small chunks) instead of reading it completely into memory. There is no room here for optimization on both RAM and CPU.
However, this is not very good for performance for streaming video via PHP, and as I said in a similar question today , if I were a server admin, I wouldn't want to do this. If at all possible, you should really consider using a regular download or a dedicated streaming server for this.
a source to share
Basically, it depends on how busy your site is. If the site is rarely visited, then you can fake this stream, however, it has a very high CPU usage. Any kind of large file / read stream is best done on a separate server on your web server. those. use cdn or an additional server to serve video files like nginx
a source to share