amplified2000 Posted April 3, 2020 Share Posted April 3, 2020 Ok, I got it working.. after looking at your initial response Hoopster I realized my mistake.. i set a path in the container from /transcode to /tmp/PlexRamScratch and then set Key 1 to /transcode as well as the Plex Server Temp Dir to /transcode and it seems to be working. Quote Link to comment
Hoopster Posted April 3, 2020 Share Posted April 3, 2020 2 hours ago, amplified2000 said: Ok, I got it working.. after looking at your initial response Hoopster I realized my mistake.. i set a path in the container from /transcode to /tmp/PlexRamScratch and then set Key 1 to /transcode as well as the Plex Server Temp Dir to /transcode and it seems to be working. And I just noticed you had TRANS_DIR defined as a variable. It should be a path. But it looks like you may have it sorted. Quote Link to comment
KJThaDon Posted May 18, 2020 Share Posted May 18, 2020 (edited) Started getting some notices today when I had a few people streaming that my docker utilization was high (75%). Checked with docker system df -v what was high in usage and noticed Plex was around 10gb. Thinking of either moving it to RAM or an unassigned SSD, but wanted to see if my config looked right first. Plex settings is /transcode Docker below Edited May 18, 2020 by KJThaDon Quote Link to comment
rodan5150 Posted May 21, 2020 Share Posted May 21, 2020 On 5/18/2020 at 1:31 AM, KJThaDon said: Started getting some notices today when I had a few people streaming that my docker utilization was high (75%). Checked with docker system df -v what was high in usage and noticed Plex was around 10gb. Thinking of either moving it to RAM or an unassigned SSD, but wanted to see if my config looked right first. Plex settings is /transcode Docker below Your problem may be due to the /transcode path not being something like /tmp if you wanted to transcode to ram or /tmp/PlexRamScratch if you use the size limited ram disk script as posted earlier in the thread. Since /transcode does not exist as a an actual directory in your setup most likely, I believe Plex is defaulting to transcoding within the docker image and that is why it is filling up. Quote Link to comment
gacpac Posted July 28, 2020 Share Posted July 28, 2020 I just test this and noticed a big impact in transcoding performance. Also, I have around 20 dockers. I was hitting my SSD IO pretty hard, every time I added or modified a large quantity of media, also messing with VMs. This should ease up things a bit. Got 32gb ram good stuff Quote Link to comment
mgutt Posted September 18, 2020 Share Posted September 18, 2020 (edited) I wanted to know which tmpfs (ramdisks) exist by default and which size they have: df -h Filesystem Size Used Avail Use% Mounted on rootfs 16G 764M 15G 5% / tmpfs 32M 292K 32M 1% /run devtmpfs 16G 0 16G 0% /dev tmpfs 16G 0 16G 0% /dev/shm cgroup_root 8.0M 0 8.0M 0% /sys/fs/cgroup tmpfs 128M 628K 128M 1% /var/log /dev/sda1 15G 254M 14G 2% /boot /dev/loop0 9.2M 9.2M 0 100% /lib/modules /dev/loop1 7.3M 7.3M 0 100% /lib/firmware /dev/md1 11T 9.9T 1.1T 91% /mnt/disk1 /dev/md2 11T 11T 809G 93% /mnt/disk2 /dev/md3 11T 9.9T 1.1T 91% /mnt/disk3 /dev/md4 11T 9.9T 1.1T 91% /mnt/disk4 /dev/md5 11T 9.9T 1.1T 91% /mnt/disk5 /dev/md6 11T 7.7T 3.3T 71% /mnt/disk6 /dev/md7 11T 5.0T 6.0T 46% /mnt/disk7 /dev/md8 11T 2.7T 8.3T 25% /mnt/disk8 /dev/md9 11T 7.4T 3.6T 68% /mnt/disk9 /dev/nvme0n1p1 932G 234G 698G 26% /mnt/cache shfs 99T 73T 26T 74% /mnt/user0 shfs 100T 73T 27T 74% /mnt/user /dev/loop2 20G 1.1G 19G 6% /var/lib/docker The main reason was to check how much size is set for /dev/shm as some people in the plex forums use this as transcoding path combined with this command: mount -o remount,size=8G /dev/shm As I have installed 32G RAM it seems that /dev/shm is limited to the size of my 16GB USB flash drive, correct? By that it would be possible to use /dev/shm/PlexRamScratch without the need of an additional script. What do you think? EDIT: After reading some websites I would say its not save to use /dev/shm as its the default shared memory in linux and not cleaned up by default. This means if other applications use this memory and its full because of Plex, this could result in performance problems or errors for other applications. So its better to use /tmp/PlexRamScratch as this would be an exclusive ramdisk for Plex alone. Does anyone know why most people suggest 4GB? I mean why isn't it 1GB or 8GB? Edited September 18, 2020 by mgutt Quote Link to comment
mgutt Posted September 19, 2020 Share Posted September 19, 2020 (edited) Yesterday, I was lazy and set only "/dev/shm/plextranscode" as my transcoding path. I checked the path and it was created: ls /dev/shm plextranscode/ But it stays empty while transcoding! I saw in the Main overview of the Unraid WebGUI that it still produces writes on the NVMe where the docker image is located. With this useful command I was able to verify it: inotifywait -mr /mnt/cache While this returned nothing: inotifywait -mr /dev/shm So the writes are not leaving the docker image. But why? The container's config looks correct: I opened the plex container's console and tried to find the path and yes its writing to a complete different path: # ls -l /tmp/Transcode/Sessions total 0 drwxr-xr-x 1 plex users 62522 Sep 19 12:49 plex-transcode-b7dnev7r0gdgfjq8267pwoxu-136bae98-3ca4-4cbc-ad26-3656b6830885 # ls -l /tmp/Transcode/Sessions total 0 drwxr-xr-x 1 plex users 62890 Sep 19 12:50 plex-transcode-b7dnev7r0gdgfjq8267pwoxu-136bae98-3ca4-4cbc-ad26-3656b6830885 # I verified if the container is able to write a file into /transcode # echo "test" > /transcode/test.txt # cat /transcode/test.txt test # ls -l /transcode/test.txt -rw-r--r-- 1 root root 5 Sep 19 12:51 /transcode/test.txt Re-checked if it exists in dev/shm: ls /dev/shm/plextranscode test.txt Strange. Re-checked plex transcoding path and its correct: Double-checked the Preferences.xml content: Why is Plex writing to a different folder... hmmm. Maybe a chmod thing? Let's check the auth: ls -l ... drwxrwxrwt 1 root root 132 Sep 19 04:14 tmp drwxr-xr-x 2 root root 60 Sep 19 12:51 transcode I chmod them to 777: chmod -R 777 /dev/shm/plextranscode root@Thoth:~# ls -l /dev/shm total 0 drwxrwxrwx 2 root root 60 Sep 19 12:51 plextranscode/ Check if its inside the docker container active and it looks good: ls -l drwxrwxrwt 1 root root 132 Sep 19 04:14 tmp drwxrwxrwx 2 root root 60 Sep 19 12:51 transcode ... # ls -l /transcode total 4 -rwxrwxrwx 1 root root 5 Sep 19 12:51 test.txt So I restart the plex container and started a different movie... aahh looks nice: inotifywait -mr /dev/shm /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS init-stream1.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS chunk-stream1-00080.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE init-stream1.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE chunk-stream1-00080.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ OPEN init-stream0.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ OPEN chunk-stream0-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS init-stream0.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS chunk-stream0-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE init-stream0.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE chunk-stream0-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ OPEN init-stream1.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ OPEN chunk-stream1-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS init-stream1.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ ACCESS chunk-stream1-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE init-stream1.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CLOSE_NOWRITE,CLOSE chunk-stream1-00081.m4s /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ CREATE chunk-stream1-00143.m4s.tmp /dev/shm/plextranscode/Transcode/Sessions/plex-transcode-08xmsae9kwytrf1u91lnijt0-d3df683f-e543-49bc-8f22-7ff29640ead4/ OPEN chunk-stream1-00143.m4s.tmp Conclusion: If you use a different path than /tmp (which is already chmod 777) f.e. a subfolder inside of /tmp you need to set chmod 777 to it, else it won't work! Edited September 19, 2020 by mgutt 3 1 Quote Link to comment
mgutt Posted September 19, 2020 Share Posted September 19, 2020 By this guide Plex uses your RAM while transcoding which prevents wearing out your SSD. Edit the Plex Container and enable the "Advanced View": Add this to "Extra Parameters" and hit "Apply": --mount type=tmpfs,destination=/tmp,tmpfs-size=4000000000 Result: Side note: If you dislike permanent writes to your SSD add " --no-healthcheck ", too. Now open Plex -> Settings -> Transcoder and change the path to "/tmp": If you like to verify it's working, you can open the Plex containers Console: Now enter this command while a transcoding is running: df -h Transcoding to RAM-Disk works if "Use%" of /tmp is not "0%": Filesystem Size Used Avail Use% Mounted on tmpfs 3.8G 193M 3.7G 5% /tmp After some time it fills up to nearly 100%: tmpfs 3.8G 3.7G 164M 97% /tmp And then Plex purges the folder automatically: tmpfs 3.8G 1.3G 3.5G 33% /tmp If you stop the movie Plex will delete everything: tmpfs 3.8G 3.8G 0 0% /tmp By this method Plex never uses more than 4GB RAM, which is important, as fully utilizing your RAM can cause an unexpected server behaviour. 11 8 Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 I am fixing to do this and have a couple questions. Since I have plenty of RAM and am not worried about limiting it can I still just follow the instructions on the very first original post? Its from 2015 so I just want to make sure its all still applicable. Quote Link to comment
Hoopster Posted October 13, 2020 Share Posted October 13, 2020 13 minutes ago, SPOautos said: can I still just follow the instructions on the very first original post? Yes, still works. At least it did for me a couple of months ago. I am now using the tmpfs/scratch disk method. Of course, Plex Pass is required but that is not mentioned in first post. You also want to select these options in the Transcoder settings: Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 (edited) 32 minutes ago, Hoopster said: Yes, still works. At least it did for me a couple of months ago. I am now using the tmpfs/scratch disk method. Of course, Plex Pass is required but that is not mentioned in first post. You also want to select these options in the Transcoder settings: Did you switch to the tmpfs/scratch disk method because you were having issues? Was Plex using up all your ram? I have 32GB of ram but I've never seen my ram utilization get over around 7-8Gb so I feel like I have plenty of headway. Edited October 13, 2020 by SPOautos Quote Link to comment
Hoopster Posted October 13, 2020 Share Posted October 13, 2020 1 minute ago, SPOautos said: Did you switch to the tmpfs/scratch disk method because you were having issues? Was Plex using up all your ram? I have 32GB of ram but I've never seen my ram utilization get over around 7-8Gb so I feel like I have plenty of headway. In addition to transcoding movies as they stream, I am running OTA TV show recording through Plex via a couple of HDHomeRun tuners. A recent change in HDHomeRun recording started using 16GB per 1-hour program. When I had two records going at once, the 2nd would fail as I only had 32 GB RAM. The HDHomeRun change was to enable time-shifting while recording. Since I never watch a recording in progress, I saw no need to use that much RAM. I also now have 64GB RAM so it likely would not matter as much. Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 (edited) 6 minutes ago, Hoopster said: In addition to transcoding movies as they stream, I am running OTA TV show recording through Plex via a couple of HDHomeRun tuners. A recent change in HDHomeRun recording started using 16GB per 1-hour program. When I had two records going at once, the 2nd would fail as I only had 32 GB RAM. The HDHomeRun change was to enable time-shifting while recording. Since I never watch a recording in progress, I saw no need to use that much RAM. I also now have 64GB RAM so it likely would not matter as much. Well, I am fixing to set up a HD Homerun OTA tuner with Plex but we mostly use it for live viewing of bad weather and such. I suppose if we decide to start recording things I'll need to change it. So when you record with HD Homerun does it put the entire recording temporarily in the transcode folder and then move it to the HD Homerun? I thought the HD Homerun saved recordings directly on it. Can you please give me a basic explanation of how tmpfs/scratch disk method resolved your issue.....just so I have a better understanding of what its doing....it sounds like I could very easily run into that issue if someone decided to start recording OTA shows. Edited October 13, 2020 by SPOautos Quote Link to comment
Hoopster Posted October 13, 2020 Share Posted October 13, 2020 1 minute ago, SPOautos said: So when you record with HD Homerun does it put the entire recording temporarily in the transcode folder and then move it to the HD Homerun? I thought the HD Homerun saved recordings directly on it. There is a version of the HDHomeRum that has its own storage. I don't have that. I have a couple of dual-tuner boxes with no storage. Recordings go to the transcode folder and then they are post-processed to remove commercials and and end up in an unRAID TV_Shows share. The good thing about running the HDHomeRun through Plex (why pay for HDHR DVR when I have a Plex Pass and can use it as the DVR?) is that I can also watch live TV from home tuners over the Internet if I don't have local TV access or prefer home local channels. Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 1 minute ago, Hoopster said: There is a version of the HDHomeRum that has its own storage. I don't have that. I have a couple of dual-tuner boxes with no storage. Recordings go to the transcode folder and then they are post-processed to remove commercials and and end up in an unRAID TV_Shows share. The good thing about running the HDHomeRun through Plex (why pay for HDHR DVR when I have a Plex Pass and can use it as the DVR?) is that I can also watch live TV from home tuners over the Internet if I don't have local TV access or prefer home local channels. How are you removing the commercials? Does Plex do that on its own when you DVR something? Well since I'm doing all this right now maybe I should just go ahead and set up the tmpfs/scratch disk method. I guess I need to go back some pages and research that a bit more. What is the tmpfs/scratch disk method doing that helps you be able to transcode with RAM but still do all the dvr stuff with the OTA? I guess I'm not following whats going on. I'm actually setting up a HD Homerun this week so I guess I need to understand how this is all working. Quote Link to comment
Hoopster Posted October 13, 2020 Share Posted October 13, 2020 4 minutes ago, SPOautos said: How are you removing the commercials? It's a Plex Live TV and DVR setting. You also might want to play around with this setting: 1 Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 44 minutes ago, Hoopster said: In addition to transcoding movies as they stream, I am running OTA TV show recording through Plex via a couple of HDHomeRun tuners. A recent change in HDHomeRun recording started using 16GB per 1-hour program. When I had two records going at once, the 2nd would fail as I only had 32 GB RAM. The HDHomeRun change was to enable time-shifting while recording. Since I never watch a recording in progress, I saw no need to use that much RAM. I also now have 64GB RAM so it likely would not matter as much. As I understand it (or maybe dont understand it) the tmpfs/scratch disk method allows you to create a limited amount of ram for Plex to use. If you were maxing out your /tmp then how are you able to have the same functionality of having two recordings going at once that use 16GB each when you have reduced your ram allocation? Does Plex start to overflow into a different location that isnt ram? I'm confused about that. Quote Link to comment
Hoopster Posted October 13, 2020 Share Posted October 13, 2020 1 minute ago, SPOautos said: If you were maxing out your /tmp then how are you able to have the same functionality of having two recordings going at once that use 16GB each when you have reduced your ram allocation? See the 2nd setting above; Convert while recording. Otherwise I would run out. I have allocated 16GB to the scratch disk. Seems to be working so far. 1 Quote Link to comment
SPOautos Posted October 13, 2020 Share Posted October 13, 2020 (edited) When using the tmp/PlexRamScratch method does it dedicate that space similar to how a VM does or is it more like a usage cap? I'm thinking it will still let a VM or docker or whatever dip into that same ram space as Plex uses....but just want to verify that it will. Edited October 13, 2020 by SPOautos Quote Link to comment
mgutt Posted October 13, 2020 Share Posted October 13, 2020 (edited) 9 hours ago, SPOautos said: Since I have plenty of RAM and am not worried about limiting it can I still just follow the instructions on the very first original post? Don't do it. If you watch two 4K movies it will probably fully utilize your RAM. And some users said it will fill it also if the "optimize" feature is used or a permanent live TV is running. 8 hours ago, SPOautos said: Does Plex start to overflow into a different location that isnt ram? No, Plex deletes the oldest transcoding parts of a movie automatically (One movie is splitted in hundreds of parts while transcoded). Having an unlimited size means the full transcoded movie is inside the transcoding dir. If it's limited in size, Plex purges the dir and removes the oldest transcoding parts of the movie. So the disadvantage of this method is, that if you jump to the beginning of the movie, the server has to re-transcode the movie which causes depending on your transcoding performance some seconds wait time. Note: Nobody says that you need to set the transcoding ramdisk to 4GB. Use 20GB if you like, but never let Plex use the total RAM. This will probably result in a server/VM/docker crash. Example (Emby killed the RAM): https://forums.unraid.net/topic/97726-memory-usage-very-high/ PS Even a 500MB ramdisk should work. 4GB is the default because many people tested this value with multiple concurrent 4K transcodings. With 5 and more 4K transcodings I would suggest to raise the size to 6 or 8GB. But everything above this size is useless. Or do you permanently jump backwards through your movie? 6 hours ago, SPOautos said: does it dedicate that space similar to how a VM does or is it more like a usage cap It's only a cap. So if you transcode nothing, it does not utilize your RAM. Edited October 13, 2020 by mgutt 1 Quote Link to comment
frodr Posted October 15, 2020 Share Posted October 15, 2020 I was able to setup as the guide. But a film lagged playing direct (116 Mb/sec). When setting transcode to smb ssd share, no lagging. How do I find out what is wrong? Quote Link to comment
mgutt Posted October 15, 2020 Share Posted October 15, 2020 41 minutes ago, frodr said: But a film lagged playing direct (116 Mb/sec) It was directly playing and its bitrate is 116 Mbit/s?! This is extremely high, even for a 4K movie. Are you sure your Client is able to render such a high bitrate? And finally this stands in contradiction to the 19% fill rate of the "/tmp/PlexRamScratch" folder. If the movie was directly played, the folder must stay empty. Its only filled on transcoding operations. Quote Link to comment
frodr Posted October 15, 2020 Share Posted October 15, 2020 2 hours ago, mgutt said: It was directly playing and its bitrate is 116 Mbit/s?! This is extremely high, even for a 4K movie. Are you sure your Client is able to render such a high bitrate? And finally this stands in contradiction to the 19% fill rate of the "/tmp/PlexRamScratch" folder. If the movie was directly played, the folder must stay empty. Its only filled on transcoding operations. It was not direct play. It made transcoding to max resolution. The ramdisk picture is somewhat misleading, 19% is just after few minutes play. The film started with long stops after a few minutes, RAMdisk full? That could explain what no stops after I set transcoding to a smb ssd share. Quote Link to comment
mgutt Posted October 15, 2020 Share Posted October 15, 2020 40 minutes ago, frodr said: RAMdisk full? 19% isn't full, but maybe your system was out of RAM?! Please check while transcoding your RAM usage with "free -h". Quote Link to comment
frodr Posted October 15, 2020 Share Posted October 15, 2020 (edited) 4 minutes ago, mgutt said: 19% isn't full, but maybe your system was out of RAM?! Please check while transcoding your RAM usage with "free -h". The film stopped later than when 19% was recorded. I will test again tomorrow. 128G of total mem, some 30% in use. Edited October 15, 2020 by frodr Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.