AVPlumber · Mixer cookbook

7. Share pacing loops and coalesce wake-ups

The L4 profile runs source fan-out on four pacing loops, with persistent event waits and fewer redundant signals.

Reviewed 15 October 2026 against e72ff8b4. These pages describe that code and named workload settings; they do not assert what every deployment runs.

Replace one fan-out thread per source

canvas.source_fan_out: "event_loop" uses one_to_many_nb on the same four pacing_* loops that distribute source pacing and timestamp callbacks. The generic mixer parser still defaults to "thread"; the L4 profile opts into event-loop fan-out.

The nonblocking fan-out requires drop=true and processes at most eight queued frames per turn so a busy source cannot monopolize the loop. It is suitable for the mixer's bounded, dropping graph; it is not a lossless backpressure substitute for arbitrary pipelines.

Do less work on each wake

The event loop uses epoll on Linux and does not wake itself when a callback on its own thread registers work. Queue events coalesce notifications until the previous notification has been consumed; they still preserve readiness. The pending-task count avoids unnecessary queue checks. These are existing framework-wide implementation changes, not per-show toggles.

Realtime pacing must round waits to the clock's effective precision. A time base finer than the clock previously caused repeated near-zero waits. Sharding limits the work per loop; it does not remove realtime pacing or give each source a dedicated CPU.

Evidence and limits

The historical 192-source workload lost 192 fan-out threads (1,081 → 889). Fan-out CPU mostly moved onto the shared loops rather than disappearing. Later event-wait changes reduced overhead; tiny CPU differences between successive readings were within measurement noise. Original combined CPU measurements and earlier pacing measurements.

Check timer lateness, starvation, sustained queue pressure and output repeats during transitions. Thread count alone is not a throughput or latency measurement. The "thread" fan-out mode remains available for comparison.

Implementation at the reviewed revision