Repository navigation
Conversation
stream.sh --netem PROFILE shapes what the relay sends to its viewers with Linux netem: mobile, lossy, congested, satellite or off. The profiles live in lib/netem.mjs. With --dashboard, a Network lab card switches profiles at runtime through /api/netem, which only takes a profile name. Only relay -> viewer traffic is shaped. The ingest and the dashboard's HTTP API are not: a prio qdisc and a u32 filter on the relay port send only those packets to netem, on eth0 and on lo (rootless Podman hands viewer traffic to the relay over lo). NET_ADMIN is added only with --netem. New CI job smoke-test-podman-netem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #12. Merge #8–#12 first; this PR then moves to
main.Why
A MoQ lab on a perfect localhost network shows little about MoQ itself. This PR makes it possible to watch, on the same stream, what happens to RTT, bitrate, jitter, frame rate and latency on a bad network.
What
stream.sh --netem PROFILE:mobile,lossy,congested,satellite,off. The profiles are defined only inlib/netem.mjs.--netem): switches profile at runtime.GET/POST /api/netemonly accepts a profile name, never a tc command.tcruns withexecFile, without a shell.Content-Type: application/json, so a page from another site can't send it without a CORS preflight, which the server never answers.prioqdisc withnetemin band 3, and au32filter on the relay's source port.eth0(rootful Podman, real networks) and onlo: with rootless Podman the port forwarder hands the viewer traffic to the relay overlo. Onlothere is an extra match on the container's own IP.moq import→ relay on localhost) and the dashboard's HTTP API (its clock-offset measurement needs a symmetric path) are not shaped.NET_ADMINonly with--netem. The image getsiproute2.smoke-test-podman-netem: the profile is applied at startup, the relay is slowed (≥ 0.3 s) and the dashboard is not, switching tooffworks, and an invalid name gets a400.Found while testing
eth0, and the rootless viewer traffic didn't go through it: 2 packets in the qdisc counters, RTT unchanged. Hence the setup onlo.tc qdisc replaceon an existing netem only changes the given parameters (ratestayed from the previous profile), so it is now delete, then add.satellitethe browser can pick the WebSocket fallback: the WebTransport/WebSocket race goes to TCP. This is documented in the README.Tests
Local, Podman rootless (podman machine, kernel 7.1):
satellite: RTT ~317 ms over WebTransport, ~413 ms (relay PROBE) over WebSocket. Latency ~630 ms over WebTransport, 776–873 ms over WebSocket. Dashboard HTTP stays at ~2–5 ms.lossy→satellite→off→congestedgives clean qdiscs each time.NET_ADMIN:--netem: RTNETLINK answers: Operation not permittedand the run stops.