Skip to main content
LIVE_HUD STREAMRELAY LAB // MEDIAMTX RTMP -> LL-HLS / WHEP / SRT AUDIT 2026-11-19 | GO RSS: 90-450 MB | EGRESS: UNMETERED VDS VS 10 GBPS
MediaMTXRTMP
MediaMTXRTMP Disclosure: Outbound /go/ links marked rel="sponsored" may earn a referral fee at zero checkout surcharge (Disclosures).
Broadcast Fixes // StreamRelay Lab

Mounting /dev/shm tmpfs for Zero-IOPS LL-HLS Segment Rings

Keeping your 7-second live HLS segment buffer in kernel RAM eliminates 432,000+ daily disk writes and guarantees sub-millisecond .m4s reads at 3,000 viewers.

Measured MediaMTX & FFmpeg Telemetry

Even fast NVMe disks suffer latency spikes during system backups or log flushes. Serving ephemeral live segments out of tmpfs keeps segment creation atomic and zero-latency.

Subsystem / SignalMeasured TargetOperational Impact
Segment Read/Write Latency< 0.05 ms (RAM speed)Zero NVMe write amplification
RAM Required per 10 Mbps Stream40 - 95 MBReserve 512 MB tmpfs ceiling
systemd Pre-Start HookExecStartPre=mkdir -pEnsures directory exists across reboots

Step-by-Step Triage & Config Remediation

  1. Create dedicated tmpfs or /dev/shm subdir: Use /dev/shm/mediamtx-hls (or mount a 512 MB tmpfs at /mnt/hls-ram) owned by the mediamtx user.
  2. Update hlsDirectory in mediamtx.yml: Point hlsDirectory directly to the RAM path and restart MediaMTX.
  3. Monitor tmpfs occupancy: Verify df -h /dev/shm stays under 25% during multi-stream broadcasts.
# /etc/fstab entry for dedicated 512 MB HLS RAM disk:
tmpfs /mnt/hls-ram tmpfs defaults,noatime,nosuid,nodev,size=512M,mode=0755 0 0

Diagnostic FAQ

Does tmpfs work for VOD recording too?

No! Never store long-term MP4/fMP4 recordings in tmpfs; write DVR/VOD recordings to persistent disk and keep only live HLS segments in RAM.

How much RAM is safe to allocate to tmpfs on a 4 GB slice?

Allocate 256-512 MB max on a 4 GB node so Go MediaMTX and the OS keep plenty of working memory.

Related Broadcast Fixes Guides

MediaMTXRTMP: Size egress Mbps & ABR cores before go-live Deploy InterServer 10G