First: Plex is really amazing! It worked so seamlessly as I would have never imagined. Matched almost all content so fast, fetches the image assets so fast, auto discovery of content is near instant. Great library and playback UX! It is really an amazingly good software product!
I want to be sure that my OMV NAS which runs Plex only spins up when Plex serves users or during the nightly maintenance timeslot or when I drop new content and it auto-discovers it. Other than that I prefer the NAS to be idle and silent, the HDD spun down. And additionally want to avoid bottlenecks or unnecessary wear leveling only due to possibly ill conceived config.
With fatrace I monitored filesystem I/O during different Plex activity phases:
- idle not serving any users (I expect zero I/O of Plex unless when in the maintenance time slots)
- serving users browsing the library
- while direct playback
- while playback with transcoding (I hoped this is done entirely in RAM, but it actually goes through persistent storage)
I discovered these circumstances:
- [Solved] HDD was spinning 24/7 although I had set Plex to not keep a log.
- Plex > Menu > Settings > Settings > General:
- Enable Plex Media Server verbose logging
- Enable Plex Media Server debug logging
- Disable both.
- Save.
- But in comparison to other settings which are effective immediately after clicking save, that setting needs a restart to be effective!
- After that shut down the container. And then restart the container.
- From the next launch on, Plex was silent and really stopped the logging permanently.
- Plex > Menu > Settings > Settings > General:
- [Open] Docker's /config/tmp-transcoding/ shall point to a directory in OMV which shall be a ramdisk (folder2ram) to speed things up and avoid HDD or SD-card wearing
- My docker compose file maps my "Plex" share to the container's internal filepath "/config"
- So the docker-container's /config/ is bound to /srv/dev-disk-by-uuid-DISK-UID/Plex/ which I refer to as PLEX-CONFIG-ROOT.
- Plex > Menu > Settings > Settings > Transcoder:
- Transcoder temporary directory:
- By default this is empty and it is then effectively: PLEX-CONFIG-ROOT/Library/Application Support/Plex Media Server/Cache/Transcode/
- I set it to "/config/tmp-tc/" so then the transcoding root effectively is at PLEX-CONFIG-ROOT/tmp-tc/Transcode/
- Beware that if you set it to "/" you set it to the root of that docker container, and that leaves whereever you defined your docker containers to life.
- All these are not speculations but observations from monitoring with fatrace.
- Transcoder temporary directory:
- What value causes what absolute filepaths to be written to, stated twice for better readability and SEO
- Schematically with the the VARIABLE PARTS IN UPPERCASE
- Concrete sample path
- Transcoder temporary directory:
Value: /config/tmp-tc
Schema: /srv/DISK-ID/Plex/tmp-tc/Transcode/Sessions/plex-transcode-SESSION/chunk-stream0-FRAGMENT.m4s.tmp
Sample: /srv/dev-disk-by-uuid-f0233da3-473e-450d-9a18-b2ae254fc439/Plex/tmp-tc/Transcode/Sessions/plex-transcode-62096kyw5d70bchi9kzdf943-6fb39671-3bde-4574-8fda-3f8c3fc3a853/chunk-stream0-00418.m4s.tmp
Value: NULL
Schema: /srv/DISK-ID/Plex/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-SESSION/chunk-stream0-FRAGMENT.m4s
Sample: /srv/dev-disk-by-uuid-f0233da3-473e-450d-9a18-b2ae254fc439/Plex/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-rod8xw5l4ochnlhr7lhvng7b-3dc1db4d-215c-466d-bf44-3180cb9c9dfc/init-stream0.m4s
Value: /
Schema: /srv/DISK-ID/dockerhome/overlay2/CONTAINER-ID/diff/tmp/Transcode/Sessions/plex-transcode-COMBINATION-OF-SESSION-AND-FRAGMENT-NO-FILE-SUFFIX
Sample: /srv/dev-disk-by-uuid-f0233da3-473e-450d-9a18-b2ae254fc439/dockerhome/overlay2/8f82e8a51445019569f6180f37c76631ff48af49abb676ec644e85164f0c69a6/diff/tmp/Transcode/Sessions/plex-transcode-210y9e6rdjxunik55bvroei4-024b1455-b632-4b31-9296-78bae25e8a17
Alles anzeigen
Transcoding session directory
/Transcoder Temporary Directory ROOT/Transcode/Sessions/session-id/
init-stream0.m4s
init-stream1.m4s
chunk-stream0-00001.m4s
chunk-stream0-00002.m4s
chunk-stream0-00003.m4s
chunk-stream0-00004.m4s.tmp
chunk-stream1-00001.m4s
chunk-stream1-00002.m4s
chunk-stream1-00003.m4s
chunk-stream1-00004.m4s.tmp
New fragments get constantly added during playback.
.tmp suffix while they get created. Then with the eventual file suffix.
I never saw old ones getting deleted while playback of the corresponding movie was ongoing (but maybe that happens after a certain treshhold)
Anyway, as soon as you stop playback, the entire session folder is deleted instantly.
Now my question
- If Plex for these temporary on-the-fly transcoding fragments has mechanisms to limit them in number and/or storage, and this is well within the limitations of a ramdisk (on your given system) then, I'd only need to know wat's the proper way on OMV6 to set up a RAM backed FS and point it there. And I am done. No need to sync this back to persistent storage. This is really only session data which can get discarded.
- If Plex has no method to keep this limited, one might run into the issue of the ramdisk overflowing…
- Then we would need a helper script which detects new session-folders within the "Transcoder temporary directory" and there always deletes a certain amount of fragments with elder timestamps or smaller numbers. Should not be too hard.
- Question is if Plex would crash already alone by this, or only if you would rewind, and the played then being puzzled that it cannot serve the fragments, as they have been pulled away.
- And then, would it crash, or be robust enough to regenerate.
- I am willing to experiment and see whether I run into these crashes or not, if you guys could give me some pointers how to properly set up a ramdisk for temporary/caching directories for docker applications in general.