How to reduce CPU and plunger usage?

I'm going to "read" (video / large) files from a server (shared environment) to clients (webbrowsers) via PHP and would first like to know if there is a way to cut down on CPU and RAM usage in any way (since I have limited ones).

+2


a source to share


2 answers


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.

+4


a source


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



0


a source







All Articles