Plex NFS Performance Optimization - Proxmox Container

Overview

This guide documents a critical performance optimization for Plex Media Server running in a Proxmox container with NFS-mounted media storage. The optimization involves increasing NFS read/write buffer sizes, resulting in an 87% reduction in system load average (from 10.76 to 1.39).

Initial Performance Analysis

System Specifications

  • Host: Proxmox VE (Debian GNU/Linux)
  • CPU: Intel N97 (4 cores, max 3.6GHz)
  • RAM: 16GB (15.8GB available)
  • Container: CT 101 (plex)
  • Storage: NFS mounts from TrueNAS (xxx.xxx.xxx.234)

Performance Bottlenecks Identified

๐Ÿ”ฅ Critical Issues:

  • Load Average: 10.76 (268% CPU oversubscribed on 4-core system)
  • CPU Usage: 0% idle time (28.6% user + 28.6% system + 28.6% nice)
  • NFS Buffer Sizes: Only 8KB (rsize=8192, wsize=8192)
  • Multiple Plex Processes: Concurrent scanning, transcoding, fingerprinting

Example Process Load:

PID    USER     %CPU %MEM COMMAND
48195  999      91.8  1.6  Plex Media Scanner (video analysis)
50671  999      71.2  0.3  Plex Media Scanner (analysis)
50238  999      30.0  0.1  Plex Transcoder

Root Cause Analysis

The primary bottleneck was inefficient NFS I/O operations due to small buffer sizes:

Before Optimization

rsize=8192,wsize=8192,timeo=14,intr
  • Read Buffer: 8KB
  • Write Buffer: 8KB
  • Timeout: 1.4 seconds
  • Result: Many small I/O operations = high CPU overhead

NFS Mount Configuration (Container)

xxx.xxx.xxx.234:/mnt/media/video    /mnt/media/video    nfs defaults,rsize=8192,wsize=8192,timeo=14,intr
xxx.xxx.xxx.234:/mnt/media/music    /mnt/media/music    nfs defaults,rsize=8192,wsize=8192,timeo=14,intr
xxx.xxx.xxx.234:/mnt/media/photo    /mnt/media/photo    nfs defaults,rsize=8192,wsize=8192,timeo=14,intr
xxx.xxx.xxx.234:/mnt/media/homevideo /mnt/media/homevideo nfs defaults,rsize=8192,wsize=8192,timeo=14,intr

Optimization Process

Step 1: Identify the Correct Location

Important: Initially made changes to Proxmox host NFS mounts (/mnt/nfs/*), but discovered Plex processes actually use container mounts (/mnt/media/*).

# Check where Plex processes are running
ps aux | grep -E "(plex|Plex)"

# Verify container mounts
pct exec 101 -- bash -c "mount | grep nfs"

Step 2: Backup and Modify Container fstab

# Backup original configuration
pct exec 101 -- bash -c "cp /etc/fstab /etc/fstab.backup.$(date +%Y%m%d_%H%M%S)"

# Update NFS buffer sizes (16x increase)
pct exec 101 -- bash -c "sed -i 's/rsize=8192,wsize=8192/rsize=131072,wsize=131072/g' /etc/fstab"

# Increase timeout for better reliability
pct exec 101 -- bash -c "sed -i 's/timeo=14/timeo=600,retrans=2/g' /etc/fstab"

# Remove deprecated 'intr' option
pct exec 101 -- bash -c "sed -i 's/,intr//g' /etc/fstab"

Step 3: Apply Changes

# Stop Plex Media Server cleanly
pct exec 101 -- bash -c "systemctl stop plexmediaserver"

# Restart container to apply NFS changes
pct stop 101
pct start 101

# Verify Plex service started
pct exec 101 -- bash -c "systemctl status plexmediaserver"

Optimized Configuration

After Optimization

rsize=131072,wsize=131072,timeo=600,retrans=2
  • Read Buffer: 128KB (16x increase)
  • Write Buffer: 128KB (16x increase)
  • Timeout: 60 seconds (better reliability)
  • Retries: 2 attempts

Updated fstab (Container)

xxx.xxx.xxx.234:/mnt/media/video    /mnt/media/video    nfs defaults,rsize=131072,wsize=131072,timeo=600,retrans=2
xxx.xxx.xxx.234:/mnt/media/music    /mnt/media/music    nfs defaults,rsize=131072,wsize=131072,timeo=600,retrans=2
xxx.xxx.xxx.234:/mnt/media/photo    /mnt/media/photo    nfs defaults,rsize=131072,wsize=131072,timeo=600,retrans=2
xxx.xxx.xxx.234:/mnt/media/homevideo /mnt/media/homevideo nfs defaults,rsize=131072,wsize=131072,timeo=600,retrans=2

Results

Performance Improvements

Before vs After:

MetricBeforeAfterImprovement
Load Average10.761.3987% reduction
CPU Idle0%~65%Normal operation restored
NFS Read Buffer8KB128KB16x increase
NFS Write Buffer8KB128KB16x increase
System StateOverloadedHealthyBottleneck resolved

Verification Commands

# Check current load
cat /proc/loadavg

# Verify NFS mount settings
pct exec 101 -- bash -c "mount | grep nfs"

# Monitor Plex processes
ps aux | grep -E "(plex|Plex)" | grep -v grep

Benefits Achieved

๐Ÿš€ Performance Benefits

  • Reduced I/O Operations: Fewer network round trips
  • Better Throughput: Larger data chunks per operation
  • Lower CPU Overhead: Less frequent system calls
  • Improved Responsiveness: Faster media scanning and transcoding
  • Better Network Efficiency: Reduced packet overhead

๐Ÿ“Š System Health

  • Load average normalized from critical (10.76) to healthy (1.39)
  • CPU utilization returned to normal levels
  • Plex operations became smooth and responsive
  • System became stable for concurrent media operations

Additional Recommendations

1. Hardware Acceleration

Enable Intel Quick Sync Video (QSV) for transcoding on Intel N97:

# In Plex settings: Settings โ†’ Transcoder โ†’ Hardware transcoding
# Enable "Use hardware acceleration when available"

2. Plex Optimization Settings

# Limit concurrent operations
# Settings โ†’ Library โ†’ Analyze audio/video tracks = Off during peak hours
# Settings โ†’ Scheduled Tasks โ†’ Configure maintenance windows

3. Monitoring Commands

# Real-time performance monitoring
top -bn1 | head -20
vmstat 1 3
iostat -x 1 2

# NFS statistics
nfsstat -c

Troubleshooting

Common Issues

1. Mount Busy Error

umount.nfs: /mnt/media/music: device is busy

Solution: Stop Plex service before unmounting or restart container.

2. Wrong Mount Location
Issue: Optimizing host mounts instead of container mounts.
Solution: Always verify where Plex processes are accessing files.

3. systemd Cache

mount.nfs: an incorrect mount option was specified

Solution: Run systemctl daemon-reload after fstab changes.

Conclusion

This NFS optimization demonstrates the critical importance of proper I/O buffer sizing for media server performance. The 16x increase in buffer sizes resulted in an 87% reduction in system load, transforming an overloaded system into a smoothly operating media server.

Key Takeaways:

  • Small NFS buffers (8KB) can create severe performance bottlenecks
  • Large buffers (128KB) dramatically reduce CPU overhead
  • Always optimize at the correct layer (container vs host)
  • Performance monitoring is essential for identifying bottlenecks

The changes are persistent and will remain in effect after reboots, providing long-term performance benefits for the Plex Media Server deployment.


Last Updated: August 9, 2025
Environment: Proxmox VE, Debian GNU/Linux, Intel N97, TrueNAS NFS