Skip to main content
Refine/Blog

Meatholes Trinitympeg — Hit Better

| Parameter | Typical Value | Effect | |-----------|----------------|--------| | target_hole_size | 2 KB – 8 KB (dynamic) | Smaller holes = finer granularity, larger overhead. Larger holes = better cache reuse but risk of load imbalance. | | worker_queue_depth | 8–16 | Controls how many holes each worker may prefetch; larger values smooth bursty inputs. | | cpu_affinity_mask | 0xFF for first 8 cores | Pin workers to dedicated cores to avoid OS scheduler jitter. | | cache_policy | STREAMING (no‑write‑allocate) | Keeps hot GOP data in L3, reduces evictions. | | max_backoff_ms | 200 | Upper bound on ingest throttling; prevents starvation of upstream protocols. |


| Area | Recommendation | Rationale | |------|----------------|-----------| | Monitoring | Export hole_created, hole_processed, cache_miss_rate, worker_cpu_pct as Prometheus metrics. | Early detection of back‑pressure or mis‑sized holes. | | Observability | Enable TrinityMPEG’s built‑in frame‑level tracing (TRINITY_LOG_LEVEL=debug) only on staging, not in prod. | High‑resolution logs help tune hole size but add overhead. | | Fail‑Safe | Wrap process_hole in a try/catch and fallback to a single‑threaded mode if a worker repeatedly crashes. | Guarantees continuity even when a rare hardware fault occurs. | | Graceful Drain | On SIGTERM, stop ingest, set sharder.flush_mode(true), and let workers finish pending holes before exiting. | Prevents truncated GOPs in VOD assets. | | Security | Use memfd_create + fchmod(fd, 0600) for the ring buffer; mount the process’s /proc/self/fd with nosuid,nodev. | Keeps raw video payload out of other processes’ address spaces. | | ABR Integration | Feed the encoder’s QP (quantisation parameter) statistics from each hole into the multiplexer’s bitrate ladder algorithm. | Enables per‑hole bitrate adaptation rather than per‑segment, smoothing viewer QoE. | | Testing | Run a “hole‑size sweep” benchmark: vary target_hole_size from 1 KB to 16 KB on a representative 4 K HDR stream, capture latency & CPU. | Empirically confirms the optimal sweet spot for your hardware. | meatholes trinitympeg hit better


+-------------------+          +-------------------+          +-------------------+
|  Ingest (RTMP/   |  -->   |  MeatHoles Sharder|  -->   |  TrinityMPEG Workers|
|  SRT, File)      |          |  (hole creator)   |          |  (encode/decode) |
+-------------------+          +-------------------+          +-------------------+
        ^                                 ^                         |
        |                                 |                         |
        |                                 |   +---------------------+--------------------+
        |                                 +---|  Output Multiplexer (ABR, HLS, DASH)  |
        |                                     +---------------------------------------+
        |                                            |
        +--------------------------------------------+
                         Monitoring & Metrics

When comparing video quality, several factors come into play: | Parameter | Typical Value | Effect |