Skip to content

Speed up Host Selection

Weston Nielson edited this page Mar 22, 2017 · 1 revision

NOTE This method hasn't been widely tested. If you try it out, let us know how it works for you!

When deciding which host to send a transcode job, PRT needs to connect to each host to in order to determine which host has the lowest CPU load. If you have many transcode machines, this can take quite some time. One way to speed up this process is to make the SSH connection to each machine persistent. With this configured correctly, when the master tries to connect to a slave, SSH will check to see if a connection is already established. If a connection isn't available, one is started, otherwise the existing one is used. Since there is overhead in opening and closing each SSH connection, making SSH work in this persistent mode should make PRT seem more responsive.

In order to enable this mode, we need to create a configuration for each transcode slave. Let's pretend that we only have one transcode slave with address 192.168.0.2. As the plex user, open up the SSH config (e.g. nano ~/.ssh/config) file using your favorite editor and add the following:

Host 192.168.0.2
        HostName 192.168.0.2
        ControlPath ~/.ssh/controlmasters/%r@%h:%p
        ControlMaster auto
        ControlPersist 2h

Make sure that the socket directory exists too (mkdir -p ~/.ssh/controlmasters). What we've done here is told SSH that when we connect to the host 192.168.0.2, look for an open socket at the location ~/.ssh/controlmasters/%r@%h:%p. If that socket doesn't exist, create it and make it available for 2 hours. You can adjust the ControlPersist parameter to your liking.

That's it, we're done. PRT will automatically take advantage of this configuration and communication with the nodes should be much faster.

Clone this wiki locally