Tips to optimize Plex Media Server?

Hi everyone!
I’ve been using diet pi for a couple months now, really enjoying the simplicity and efficiency of this distribution.

My setup is :

  • Raspberry PI 4B / 2G RAM
  • Official case with heatsinks, no fan
  • External 3.0 USB HDD 4To, with a USB Y to add a power source. I moved the userdata onto the HDD.
    It’s formatted in Ext4
  • Micro SD 16Go

I use Dietpi with Samba, Deluge, and mainly Plex Media Server.

I’m having a few issues with Plex. I have a library of both 1080p files for remote viewing and 4K for local viewing (with a Xiaomi Mi Box 3 using Kodi and the plex add on). All in direct play of course, and everything is cabled with ethernet.
It works mostly really fine, but with some heavy 4K files with HD audio, the audio starts stuttering after a while, not much but some micro-stutters every few minutes, enough to drive me crazy.
Weird thing is when i add the samba share in kodi without using the plex add on, the file seems to play ok. So, not sure which part of my setup is the bottleneck here. I could play all the files in kodi without using plex, but i would like to keep my library in one place.

CPU config and benchmark below : (overclocking is set on safe)

HDD Benchmark :

Seems like my SD card could be a problem, the rootFS write is very slow…
I tried using a different SD card, using dietpi-backup to backup / restore my data but then, after restoring my backup file and rebooting the system it doesn’t start, not sure why…

So, any tips to how to optimize my setup? Or clues about why i can’t restore my backup file?

Thanks !

did you checked CPU/Mem consumption while playing files on Plex?

Yes, CPU is usually under 10%, RAM around 30%

My buddy showed me that if you use /dev/shm as the Transcoder temporary directory it reduces read and writes to the drives, in effect it becomes a RAMDrive for the transcoded data for streaming and RAM is immensely faster than any drive or SD card

However be advised it does use RAM and on SBC that can be somewhat limited

https://forums.serverbuilds.net/t/plex-transcoding-and-ram-disks/625

That’s a nice tip, however as i don’t use transcoding (everything IS direct play) i’m not sure it will help. I will try it though!

Old topic, but why this method opposes to this: https://dietpi.com/phpbb/viewtopic.php?t=7619&start=10