wnielson / Plex-Remote-Transcoder

A distributed transcoding backend for Plex
MIT License
646 stars 58 forks source link

Add wake-on-lan so that a sleeping node could be used when more transcodering power is required. #68

Open nydave69 opened 6 years ago

nydave69 commented 6 years ago

Add wake-on-lan so that a sleeping node could be used when more transcodering power is required.

The command to WOL is;

wakeonlan -i 192.168.44.255 00:0e:c4:d4:d1:c6

command (-i interface) mac address of the node The interface is determined by using the broadcast address of the sleeping node and the mac address of the sleeping node. Would be nice to gather when setting up the node as a slave and storing with its IP address.

if I issue the command from a terminal it takes about 5 seconds for the node to wake and become stable.

Sleeping nodes just need to be setup, I set mine to watch port 22 for inactivity and to wait 10 minutes before going to sleep, other settings maybe needed depending on performance, they are set on each slave independently.

When to send the WOL command? Processing power of the current active nodes is greater the 80%, not sure what numbers should be used, something testing will tell.
But the power savings when not in use will be the biggest benefit as a node would only power up when needed. Add sleep as transcoderings complete.

nydave69 commented 6 years ago

managed to get most of it working.. only thing I haven't figured out yet is what is returned by load in the load balancing section. I would like to set a threshold like say 80%, if the current loads exceed that value another slave is awaken. From what I can figure out three values are returned.. If I run prt get_cluster_load the returned values don't seem to reflect what is happening on the slaves.

Troubadoure commented 6 years ago

Would love to see how you managed to configure this

liviynz commented 6 years ago

The usage comes from the load average which isn’t an exact point in time value but over a short period of time so if the slave was busy just before it still sees some of that value. There’s good reasons to be using that over a point in time value however it does need a bit of a rework to take other items into consideration. I do have an enhancement on my list around his usage is calculated and allowing for profiling so certain slaves are given preference over others even if they’re busier, only using certain slaves for certain types of transcoding, etc.

nydave69 commented 5 years ago

Since there wasn't any movement on this project and Plex versions have jumped way ahead. I've dropped working with this here.