Solving performance issues with Plex, like Stuttering in TrueNAS Scale

Switching from Unraid has been a huge learning process for me. There was a lot of positive things about Unraid as well as some negatives. Most of the negatives I had were around raw performance and ZFS configuration options. For positives, it felt like containers worked properly out of the box more often.

Fiddly issues with Kubernetes in TrueNAS has been a bit of an ongoing saga. From my previous post about Plex dying when I swapped GPUs to Minecraft being fiddly to setup or issues around my initial Nginx Reverse Proxy setup.

The latest came up with Plex again. For the most part it was working, but occasionally I’d have weird hiccups with performance. Like the quality being kind of low, the video just stopping or must frustrating was that every video was taking longer to start on my new server then they did with my older Unraid server.

The Specs

Unraid Server

  • AMD Ryzen 3600x
  • 32GBs DDR4
  • nVidia Quadro M2000 4gb
  • 1Gigabit NIC

TrueNAS Scale Server

  • AMD Epyc 7402
  • 128GBs ECC DDR4
  • nVidia RTX 3060 12gb
  • 10Gigabit NIC

Performance

From the specs you can probably guess that the raw performance numbers were wildly different. A great example is copying a file over to the servers.

On the Unraid server I’d see performance in the single disk write range minus the network adapters max speed so 110-120MB/s, assuming the network wasn’t the limiting factor I could probably get in the 50-250MB/s range due to parity and again, single drive performance. Reads CAN be better which is a great features if you’re wanting a media server with a bunch of random drives but if you’re accessing the same disk for two reads you can still run into performance issues.

With the TrueNAS server you can write at the 10G NICs max speed, I’d see stable 1GB/s writes fairly constantly when transferring ISOs

What was the issue?

So again I kept running into weird performance issues with Plex. I thought maybe it was my wireless network so I tweaked it a little, noticed my Apple TV was connected to the garage AP instead of the living room one so I forced that to switch. I upped the CPU count and ram even though those didn’t seem to be utilized much at all. Nothing seemed to really be helping until I ran across this post https://forums.truenas.com/t/truenas-plex-performance-unable-to-stream-network-to-slow/22223/13

“marcnarc” enabled the “Host Network” option in the TrueNAS configuration for the Plex app. This change allowed the Plex server’s container to use the TrueNAS host’s IP address instead of an internal Kubernetes/Docker subnet address. As a result, Plex performance returned to the levels experienced with CORE.

I think what may have been happening is the following.

  • Host Networking ensured that full-speed, direct communication was possible, eliminating performance bottlenecks as well as inefficient relays.
  • Running Plex inside a Kubernetes/Docker virtual network introduces extra routing overhead.
  • If Plex thought the network was slow or remote, it might have forced lower-quality streams or unnecessary transcoding.

I think the first and second points were the key items. I think there was some relay + some routing issues that were causing the video to stop, take a while to start and suffer from lower quality.

In addition to this I upped the Transcoder default throttle buffer value to 600 to help buffer as much of a transcode as I can ahead of time which I think should help with remote streaming.

In all, these changes together made everything work perfectly and the experience finally seems to be fitting the hardware it’s running on!


Comments

One response to “Solving performance issues with Plex, like Stuttering in TrueNAS Scale”

  1. This was super helpful! I had the same issue.

Leave a Reply

Your email address will not be published. Required fields are marked *