Distributed Transcoding/Scaling

Wow, 6 years and this thread is still active.

Now, it may not fit everyone’s needs, but I have built something for myself that accomplishes part of what has been described in this thread, and may be of use to someone or give some ideas.

In my case I decided to shoot myself in the foot, and instead of buying proper standalone hardware, I’m running most of my apps at home on a Raspberry Pi 3 cluster of half a dozen nodes, using Docker Swarm. And that includes running PMS on it as well (I know, I know, It was mainly to see how far I could push the hardware and experiment with it).

So in order to be able to use multiple nodes for transcoding, I’ve basically built 3 things:

  1. A custom Docker image based on the official linuxserver ARM image, in which I rename plex’s own transcoder and put a shim instead to call a NodeJS app, which ultimately communicates to an Orchestrator over websockets.

  2. An Orchestrator (node application running in its own container which receives all transcoding requests from PMS and forwards it to one of the active Workers available over websockets.

  3. Worker docker image based on the PMS image as well, with another custom NodeJS app running on it, which receives requests from the Orchestrator and kicks off the transcoding and reports progress back. Workers can come online or go offline and the Orchestrator manages their registrations and availability. These Workers run as replicated services managed by Swarm.

The advantage of all this, is that upgrading Plex when a new version comes out is basically just rebuilding the docker images to get the update. I’m not making any changes to the actual Transcoder or writing my own so everything just works whenever a new version is released and settings change.

Now, for all this to work, I actually have the Plex’s Application Data and transcoding folders running off shared storage over NFS (mounted on all nodes) and the Media Libraries are all in a NAS (also mounted in each node). So all nodes are able to mount the same docker volumes and access the same data in the same locations.

I know it’s overkill to build something like this when I could just buy one single powerful server and call it a day, but it was fun to build, and see if it was actually possible to offload work without breaking PMS.

The code for all this is in GitHub if someone wants to experiment:

And the Docker images for ARM are here:
https://hub.docker.com/repository/docker/pabloromeo/clusterplex/tags

Unfortunately I haven’t written documentation on it or examples of how to configure it, but if anyone finds it interesting and with a similar setup I can try to find the time and at least include my current swarm stack configuration settings.

One thing I wish Plex would support, is actually processing more than one item at a time from the queue for Optimized Versions/Conversions. If it supported that, the cluster could optimize things in parallel quite efficiently instead of just handling one at a time.
I created a Feature Request for this, so if you can, please vote :smile:: Optimize / Transcode content in parallel

5 Likes