Plex: Guide to Moving Transcoding to RAM


Recommended Posts

So I created a 8GB RAM disk under /tmp/, set Plex to use it and kicked off a 4K movie in a Web Browser to ensure it was Transcoding. Monitoring the directory I saw it grow to 100% usage (about an hour into the movie) and then it emptied itself and has started growing again. I assume (dangerous I know) that it will continue doing this and that multiple transcoding streams will just cause this to happen sooner. I'll leave it like this for a while and monitor.

 

Edit: Kicked off two transcoding streams (from 4K, which I'm impressed my system managed - see attached image) and my observation was that the usage grew to 8GB (100%) and then dropped to 4GB (50%). So it seems Plex might be dividing the available transcode space evenly between jobs and purging history once they fill their "allowance".

 

2019-12-23 14_16_18-Tautulli - Home _ media.png

Edited by Simon
Link to comment
5 hours ago, Simon said:

I'm playing around with this on my setup. I notice the Plex support site says:

Wouldn't that be way more than 4GB?

I think that use to be correct, but plex has gotten better at reading a RAM disk size. I use to use one exclusively until I started using the dvr, which needs a scratch disk the size of the recording (which is big for football games.)

 

sometimes when setting up a RAM disk for the first time, plex may crash the stream filling it up, but then never exceeded it again. Sometimes it reads the size right the first time and there are no problems.

Link to comment
  • 2 weeks later...

i'm confused I tried setting up my unraid plex container for ram transcoding, I'm seeing several ways of doing it.  regardless what i do my cpu pegs at nearly 100% and and the memory bearly changes (when i watch my unraid dashboard).

any suggestions, or is this normal.

 

I'm running unraid v680

the latest plex docker

AMD FX™-8320 Eight-Core @ 3500 MHz

32 gb ram

Link to comment

I could be mistaken but I don’t think the two are necessarily related. The CPU being pegged suggests that a transcode is occurring. Your chip has an ~8000 passmark so it should work. Are you trying to transcode 4K or something?

I’m thinking if the CPU is pegged that it would be pegged wherever your transcode location is.

Link to comment

Not sure why I didn't read about this before but I've just set it up (takes 30 seconds to do) and tested it and it works perfectly. Transcoding a 1080p movie to 480p on a poor connection with the server's IGP (some Intel HD something integrated into my Xeon E3-1245 V6) and it took about ~30MB of space on the FS... which translated to +30MB of RAM used too. As soon as I stopped the playback, the files were deleted. I'll test it for a while and as long as Plex keeps deleting its transcoding cache, this should be fine.

 

CPU is usually around ~120% when transcoding with the GPU (or like 12% in the webUI, it's a 4c8t CPU). Without GPU transcoding it would usually gobble all 8 threads immediately until it throttled a little bit. I added another extra parameter to the docker to make sure it never takes more than 75% of my CPU: --cpus=6.

Edited by dnLL
Link to comment
  • 2 weeks later...

I think that people also need to take into account the difference in speed between RAM and SSD not just that SSD's wear out faster.

 

The main benefit to a RAM drive is its increased read and write speeds compared to an SSD or hard drive. ... Running our own quick benchmark test using XBench on a Macbook Air showed that write speeds for a RAM drive were an average of 4.5 times faster than the built-in SSD and read speeds were 6.3 times faster

Link to comment

I have been experimenting with this today.

The transcode->tmp worked fine and Plex is operating without issue.

I laugh however when I don't see a notable blip in RAM usage, but I have 192GB of RAM and two Xeon E5-2665 CPUs.

 

I have a gigabit fiber internet connection, and it pisses me off when I see my users transcoding from 1080p down to SD because of their own slow internet. 

 

At least I know I am doing everything possible to make the sever side without impedance. 

  • Haha 2
Link to comment
On 1/16/2020 at 9:27 PM, BenDibble said:

I have a gigabit fiber internet connection, and it pisses me off when I see my users transcoding from 1080p down to SD because of their own slow internet. 

 

And they'll still blame you for "bad quality content" because they can't use the app right to increase the quality setting .... SMH 🤣.  This is why I don't share my library (of Creative Commons content 🙃) with non-techies anymore 😋.

Link to comment

On the fringe of being related, here is a forum post I made on the Plex forum in 2018 cataloging some of my experiences while working with a RAM drive on a Windows server.  Plex does some really strange stuff under the hood.

 

TL;DR:  Don't waste your time ... unless you have lots of RAM and nothing better to do with it (*looks down as to not make eye contact with anyone here* 😉).

 

https://forums.plex.tv/t/plex-transcoder-ram-drive-experience

 

 

Edited by JesterEE
Typo
Link to comment
  • 2 weeks later...

Hey all,

I followed the steps and Plex seems to be running fine. I decided to implement this only to extend the life of my SSD, not the potential performance benefits. 

 

However, when i check my appdata share, I see the plex docker, and the transcode folder sitting on my cache disk. How can i verify this is actually transcoding to my ram? I have 32Gb of ram and dont see any delta now. 

Edited by Aerodb
Link to comment
8 minutes ago, Aerodb said:

How can i verify this is actually transcoding to my ram?

What is your RAM transcoding location? /tmp?

 

Just look in the path you have set for RAM transcoding and see if there is a Transcode/Sessions folder.  When actively transcoding, files will be created in the Sessions folder.

Link to comment
2 minutes ago, Aerodb said:

below is my docker config.

In Plex, what did you set as the transcode location?  You have two variables in your docker config which could potentially determine where transcoding takes place.  You have a TRANS_DIR variable set to /config/transcode (your Plex appdata folder on the SSD) and another set to /tmp.  Which container path did you specify in Plex  (TRANS_DIR or /transcode)?

 

You don't need both.

Link to comment
1 minute ago, Hoopster said:

In Plex, what did you set as the transcode location?  You have two variables in your docker config which could potentially determine where transcoding takes place.  You have a TRANS_DIR variable set to /config/transcode (your Plex appdata folder on the SSD) and another set to /tmp.  Which container path did you specify in Plex  (TRANS_DIR or /transcode)?

 

You don't need both.

in plex i set it to /transcode . pictured below. 

 

image.png.7523ea16aac111afdb5b95e50b9aa5ce.png

Link to comment
30 minutes ago, Aerodb said:

in plex i set it to /transcode . pictured below.

Then it should be transcoding in /tmp in RAM.  You can open a terminal session from the WebGUI and do a 'cd /tmp' from the command line.  You should see the Transcode/Sessions folder there.  If Plex is transcoding you will see the transcode files there.

Link to comment
14 hours ago, Hoopster said:

Then it should be transcoding in /tmp in RAM.  You can open a terminal session from the WebGUI and do a 'cd /tmp' from the command line.  You should see the Transcode/Sessions folder there.  If Plex is transcoding you will see the transcode files there.

Thank you for this help. I have a final question.

 

So I did check the web terminal my tmp/Transcode/Sessions directory. I See items in there. there are more items when i start streaming/transcoding a video. (labeled plex trancode....)

 

Does this mean that anything in the tmp directory is always put into ram? I ask in case there are other optimizations i could make with other dockers the same way. 

 

Thank you in advance for the guidance. 

Link to comment
30 minutes ago, Aerodb said:

Does this mean that anything in the tmp directory is always put into ram?

The entire unRAID OS runs in RAM.  Any path outside of /mnt/xxx (where user and disk shares reside) and /boot (flash drive) is going to be in RAM; that means /tmp or any other path you create.

Link to comment
9 hours ago, Hoopster said:

The entire unRAID OS runs in RAM.  Any path outside of /mnt/xxx (where user and disk shares reside) and /boot (flash drive) is going to be in RAM; that means /tmp or any other path you create.

Thank you for the break down. That definitely adds clarity. 

Link to comment
On 1/31/2020 at 10:06 AM, Hoopster said:

The entire unRAID OS runs in RAM.  Any path outside of /mnt/xxx (where user and disk shares reside) and /boot (flash drive) is going to be in RAM; that means /tmp or any other path you create.

Hey folks,

    After switching to the RAM transcoding, I have found an issue that im curious if anyone else has come up against, and overcome....

 

   I have the homerun HD set up to allow me to stream live TV to the plex server and DVR media to the server. My homerun has two tuners and I have been able to DVR two shows at once to the server. BUT now that media is transcoding to RAM, it seems to error on the second show. Showing not enough storage space. as if my 32gb of RAM is not enough for two 60 minute shows. these are 720i (not 720p) streams, should be more than enough ram space. Also, while this is happening, the RAM is never over 40% used. 

 

Any help,advice or guidance is greatly appreciated. 

Link to comment
12 minutes ago, Aerodb said:

I have the homerun HD set up to allow me to stream live TV to the plex server and DVR media to the server. My homerun has two tuners and I have been able to DVR two shows at once to the server. BUT now that media is transcoding to RAM, it seems to error on the second show. Showing not enough storage space. as if my 32gb of RAM is not enough for two 60 minute shows. these are 720i (not 720p) streams, should be more than enough ram space. Also, while this is happening, the RAM is never over 40% used. 

 

Any help,advice or guidance is greatly appreciated. 

This is why I disabled RAM transcoding and went back to doing it on an SSD.  I have 128GB RAM, so it's not like I don't have options.  I think what was happening is that the RAW stream of the show was very big and for some reason was trying to play a full copy in the ramdisk.  I think I did validate at some point that's what it did (there's some commentary around it earlier in this thread I think).  There needs to be a way to separate the two out and then it would work I suppose, but I didn't look into it much further - too many projects on at the moment. :D

  • Like 1
Link to comment
6 hours ago, Aerodb said:

 I have the homerun HD set up to allow me to stream live TV to the plex server and DVR media to the server. My homerun has two tuners and I have been able to DVR two shows at once to the server. BUT now that media is transcoding to RAM, it seems to error on the second show. Showing not enough storage space. as if my 32gb of RAM is not enough for two 60 minute shows. these are 720i (not 720p) streams, should be more than enough ram space. Also, while this is happening, the RAM is never over 40% used. 

 

I no longer have transcoding to RAM configured for this reason. It was fine for a long time with HDHomeRun recorded shows, but, Plex changed something recently with how transcoding works that requires a lot more RAM/disk space when recording TV shows.  I would see the same thing if two overlapping shows were scheduled to record. The first one would record without issue and the second one would fail. I have 32GB RAM in my server.   I think it has something to do with being able to playback, FF/Rew a show while it is still recording and the setting mentioned below.  

 

I switched transcoding to a 1TB SSD (which also has other uses) and no longer have the problem.  

 

You might also try setting "Convert Video While Recording" to Off as this will use more RAM.  Do that first and see if it makes a difference.  If not, you may need either more RAM or a different transcoding location.

 

image.png.9632f6442c3ee8d5bf281c5ec1fa528f.png

Edited by Hoopster
  • Like 1
Link to comment

I recently set Plex transcoding to /tmp, verified that the sessions were showing up as expected int he /tmp folder.  Seemed to be working fine, EXCEPT for users on Amazon Fire Sticks.  They are able to browse Plex and select a movie, but as soon as they play it, they get an error "Playback has stopped because the connection to the server has been lost".  I had 2 Fire stick users confirm this today, and at the same house their Rokus and other devices work fine.  When I move transcoding back to the default directories on an SSD, everything works again. 

 

Could the Android clients be managing transcodes differently?  I find this so odd.  

 

Xeon 2699v4, 32GB RAM.  I thought this would be enough but maybe not?

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.