My Plex Server Was Working Much Harder Than It Needed To

Category: , , ,

Fixing unnecessary MPEG-2 transcoding, discovering a runaway Cinnamon desktop, and considerably reducing CPU utilization and power consumption on my Proxmox Plex server.

Another Little Home Lab Project

Back in October, I rebuilt my aging Plex server, moving from Linux Mint 19.3 to Mint 22.3. The new installation had been working well, but I’d noticed some unusually high CPU utilization. It was most noticeable when time-shifting Bears games recorded through my dual-tuner HDHomeRun, or when my Dad was watching something remotely that required transcoding. Those situations made sense, but I was also seeing extended periods of high CPU activity that I couldn’t explain.

The Plex VM runs under Proxmox on one of my Dell PowerEdge R720 servers, with eight virtual CPUs assigned. I wasn’t particularly happy with how much of that processing capacity was being used, especially since I keep the R720’s cooling fans running at fixed speeds through IPMI to reduce noise. Higher CPU utilization means more heat, and the fans aren’t going to speed up automatically to compensate.

On Thanksgiving, I finally decided to look into it. As things turned out, there were two separate problems, and the bigger one had very little to do with Plex.

First Problem: MPEG-2 Transcoding

Most of my television recordings come from Plex DVR and are stored in their original MPEG-2 format. On Thanksgiving afternoon, I was watching the Chicago Bears play the Detroit Lions on my Roku Ultra. The recording contained 1080i MPEG-2 video with AC3 5.1 audio.

While watching the game, I noticed that Home Assistant was displaying my server’s power monitoring card, which I’d configured to appear whenever the R720 draws more than 180 watts. That was higher than I liked seeing, so I opened the Plex Dashboard to see what was going on. Sure enough, Plex was transcoding the MPEG-2 recording rather than simply sending the original video to the Roku.

I’d already configured Plex to use a 16GB RAM disk for transcoding temporary files. That works well for keeping transcoding activity off my storage drives, but it doesn’t reduce the processing required to decode and re-encode video.

I started looking through the Plex settings on the Roku and found:

  • Direct Play: Auto
  • Allow Direct Stream: Enabled
  • Allow MPEG2: Disabled

That last setting looked promising.

I enabled Allow MPEG2, along with the Experimental 1080p MPEG2 option that appeared beneath it. Plex warned that MPEG-2 direct streaming was normally limited to 720p or lower, but since my recording was 1080i, I figured the experimental option was worth trying.

I restarted the recording, and the Plex Dashboard showed exactly what I wanted.

Video: 1080i (MPEG2VIDEO)
       Direct Stream

Audio: English (AC3 5.1)
       Direct Stream

Excellent! Plex was no longer converting the MPEG-2 video into H.264. It was Direct Streaming the original video and audio without re-encoding either one.

That solved the transcoding problem with my Roku, but the server was still using considerably more CPU than I expected.

Another Plex User Was Also Transcoding

While I was testing, my Dad was watching a movie remotely (from his house) through my Plex server. Plex was converting its 1080p HEVC Main 10 video into H.264, along with converting the AC3 5.1 audio to AAC.

The remote Roku was receiving an approximately 8 Mbps stream, while my local Roku was receiving the MPEG-2 recording at around 17 Mbps.

I checked my Plex server’s Remote Access settings to make sure I hadn’t inadvertently restricted remote streaming. The upload speed was configured at 800 Mbps, and the remote stream bitrate limit was set to Original (No limit). Nothing there appeared to be causing the transcode.

I believe he has a Roku Ultra LT, which should support HEVC playback, but I haven’t confirmed the exact model or all of his Plex settings. I’ll check that next time I’m at his house.

Meanwhile, I wanted to see exactly what was consuming the server’s CPU resources. From the Mint terminal, I ran:

ps -eo pid,comm,%cpu,%mem,args --sort=-%cpu | head -15

The Plex Transcoder process was using approximately 162% CPU, converting the remote user’s HEVC video to H.264 using libx264. That was software transcoding, which explained at least some of the CPU load.

I stopped my Bears recording to see whether it made any difference, but CPU utilization barely changed. Apparently, getting the Roku to Direct Stream MPEG-2 had taken care of my local playback problem.

Looking further down the process list, another entry caught my attention: Cinnamon.

Why Is Cinnamon Using So Much CPU?

The rebuilt Plex VM runs Linux Mint 22.3 with Cinnamon. I like having a graphical desktop available, even on a server, which is why I’d chosen it back in October.

But Cinnamon was using approximately 91% CPU, and I wasn’t even using the desktop at the time. I decided to check how the VM was handling graphics:

inxi -Gxx

The relevant output was:

Graphics:
Device: Red Hat bochs-drm
Display: X.Org
Renderer: llvmpipe (LLVM 20.1.2 256 bits)

Well, that was interesting.

The VM was using Mesa’s llvmpipe software renderer rather than hardware-accelerated graphics. This meant Cinnamon was relying on the CPU for graphical rendering instead of using a GPU, which the server did not have.

That isn’t necessarily unusual for a virtual machine under Proxmox, but Cinnamon is a fairly graphics-intensive desktop environment. I wondered how much processing it was actually using at that moment.

The earlier ps command reported CPU utilization averaged over the process’s lifetime, so I ran top to see what was happening right then:

top -o %CPU

The results were considerably worse than I expected.

ProcessCPU utilization
cinnamon379.9%
firefox-bin81.8%
Xorg25.4%
Plex Media Server1.3%

Yes, Cinnamon was consuming the equivalent of nearly four virtual CPUs all by itself!

Linux reports process CPU utilization relative to a single logical processor, so 379.9% represents approximately 3.8 vCPUs worth of processing.

With eight vCPUs allocated, the Mint VM was using nearly 64% of its total CPU capacity. Plex itself was barely doing anything.

At this point, I started looking back through the CPU utilization history in Proxmox.

Looking Back at the CPU History

The CPU graphs from the previous several days were rather revealing.

There were extended periods where utilization remained around 70–75%, sometimes for hours at a time. Other periods showed activity closer to 80–90%, followed by abrupt drops to almost nothing.

I’d previously assumed much of that activity was Plex transcoding or performing maintenance. Some of it undoubtedly was, particularly when someone was streaming remotely. But after seeing Cinnamon consume nearly four vCPUs, I had a much better idea of what might have been happening during those extended periods of high utilization.

I couldn’t attribute every historical spike to Cinnamon, but I’d seen enough to know it was a problem worth addressing.

The Plex VM's CPU history showed long periods of 70–80% utilization, including times when I wasn't actively using the server.
The Plex VM’s CPU history showed long periods of 70–80% utilization, including times when I wasn’t actively using the server.

Replacing Cinnamon With Xfce

Rather than spend a bunch of time troubleshooting Cinnamon’s software rendering, I decided to try a lighter desktop environment.

Linux Mint offers Xfce, which is considerably less demanding graphically than Cinnamon. Since I rarely interact directly with the Plex server’s desktop (and then just with Firefox), I didn’t see much reason to keep running a heavier environment.

Fortunately, I didn’t have to rebuild the VM again. Xfce can be installed alongside Cinnamon, allowing me to switch desktop environments without removing the original installation.

I ran:

sudo apt update
sudo apt install mint-meta-xfce

Once the installation completed, I logged out of Cinnamon and selected the Xfce session at the Mint login screen. The new desktop came up normally. It was a little different from Cinnamon, but perfectly suitable for what I needed. I found the terminal and checked CPU utilization again:

top -o %CPU

Now THAT was better.

ProcessCPU utilization
firefox-bin5.9%
Xorg3.3%
xfwm41.0%
xfce4-panel1.0%
Plex Media Server1.3%

The overall CPU utilization had dropped to approximately 2.1%, with the system reporting 97.9% idle. Even Firefox was using considerably less CPU than before.

Here’s how the two desktop environments compared:

MeasurementCinnamonXfce
Overall CPU utilization63.7%2.1%
Desktop/window manager process379.9%1.0%
Xorg25.4%3.3%
CPU idle36.3%97.9%
One-minute load average6.570.35

These were snapshots taken a few minutes apart rather than carefully controlled benchmarks, but the difference was pretty remarkable. Plex was still running, and I still had a graphical desktop available whenever I needed one. Xfce was simply doing the job without consuming several virtual CPUs in the process.

I left Cinnamon installed for now. There’s no reason to remove it until I’m certain Xfce will work reliably over the longer term.

What About Power Consumption?

The CPU improvement was impressive enough, but I was also curious what it meant for actual electrical consumption.

As I mentioned earlier, Home Assistant displays a monitoring card whenever the R720 draws more than 180 watts. Besides power consumption, it also shows the temperatures of both processors.

I’d been seeing that card appear fairly often, and looking back at the power history, I could see why. Starting around 4 PM, while I was watching the football recording and investigating the CPU utilization, the server was frequently drawing between 200 and 250 watts.

After switching from Cinnamon to Xfce and getting the Roku to Direct Stream MPEG-2 recordings, power consumption dropped to approximately 140 watts. Even better, we started watching another DVR recording around 8 PM, and the power barely changed.

That was a pretty satisfying result!

Of course, these measurements are for the entire physical R720, not just the Plex VM. Other virtual machines were running, and another Plex user had been transcoding video during part of my testing. I can’t attribute the entire reduction to Cinnamon alone, but the CPU measurements and power history certainly suggest I’d eliminated a substantial amount of unnecessary processing.

And Then There Are the Temperatures

The power consumption wasn’t my only concern. I’ve written before about controlling the cooling fans in my R720s through IPMI, keeping them at fixed speeds to reduce noise in the basement. The downside is that when the CPUs get busy, their temperatures increase without the fans automatically speeding up.

I do have a couple of scheduled tasks on the dodeca to help with that. At 8 PM each evening, a batch file increases the fan speeds on both R720s a few notches. Since I’m rarely spending much time in the basement at that hour, the additional noise isn’t much of a concern. Another task runs at 6 AM to return the fans to their normal, quieter speeds.

That helps with cooling overnight, but it doesn’t address the unnecessary CPU activity I’d been seeing during the day. Reducing that load should help keep temperatures down without having to increase the fan speeds further. I haven’t done a controlled temperature comparison, but I’m certainly happier knowing the processors aren’t generating all that extra heat for no good reason.

Testing Plex Again

With Xfce running and the Roku’s MPEG-2 settings corrected, I tried another DVR recording. Everything worked normally, CPU utilization remained low, and Home Assistant showed the R720 still drawing approximately 140 watts. Starting playback had barely affected power consumption.

That was really what I’d wanted in the first place: to watch a recorded television program without putting an unnecessary load on the server.

I’ll investigate the remote transcoding issue another time. If Dad’s Roku Ultra LT can Direct Play HEVC video, there may be some additional CPU savings to be had. I still need to confirm his exact Roku model and playback settings, but for now, I’m happy with the results.

Was It Worth the Effort?

Absolutely, especially considering how little work was involved.

What started as an attempt to reduce CPU usage while watching Plex DVR recordings turned into something I hadn’t expected. Fixing the MPEG-2 transcoding on my Roku was easy enough, but discovering that Cinnamon was consuming nearly four virtual CPUs while doing practically nothing was a surprise.

Switching to Xfce made an enormous difference. CPU utilization dropped from around 64% to just 2%, and the R720’s power consumption settled around 140 watts instead of the 200-plus watts I’d been seeing.

I’m also pleased to have reduced the unnecessary heat being generated, particularly since I keep the R720’s fans running at fixed speeds. The eight vCPUs are still there when Plex actually needs them, but they’re no longer being wasted on a desktop I rarely use.

Considering my recent adventures with a failed R720, moving drives between servers, and upgrading OpenMediaVault, it was nice to have a project that didn’t involve buying anything, rebuilding a VM, or spending half the day troubleshooting.

A Roku setting and a lighter Linux desktop. That’s all it took.

I’ll take an easy win like that anytime.

Topics

Leave a Reply

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