joule-moq-relay: a fan-out holds up no other track, and each core has its own socket #587
Loading…
Reference in a new issue
No description provided.
Delete branch "relay/fanout-shards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2 of the relay's fan-out work, after #583. Two limits remained once an object was held once: one track's fan-out held up every other track, and one UDP socket took every packet of every viewer.
What changes
Arc<Vec<Arc<DownSub>>>, written withArc::make_mut).fan_out_object,end_subgroupandfan_out_datagramtake the snapshot under the track's lock, drop the lock, and push to each subscriber outside it. A subscription that has left is markedgoneunder its own parameters' lock, so nothing is pushed to it after its PUBLISH_DONE. Unit test:a_subscription_that_left_passes_nothing.limits.quic_sockets; 0 = one per core up to 16, Linux only, otherwise 1). The sockets share a port with SO_REUSEPORT. A cBPF program steers each datagram by the first byte of its destination connection ID (long header offset 6, short header offset 1).ShardedCidissues 8-byte IDs whose first byte maps back to the socket that issued them, so a viewer whose address changes stays on its session.tests/quic_sockets.rs: 32 viewers on 4 sockets all rebind mid-session and all keep receiving.examples/fanout_load.rsgains--relay-sockets. Its own client sockets now get 4 MiB buffers: without them, the harness dropped packets and looked like a relay collapse.Measured (Linux, 32 threads, 8 relay cores, shared host at load 16–24, three rounds each):
Falsified: the steering program's offsets, its modulus and the CID mapping were each broken in turn. 5 of 5 were caught by
tests/quic_sockets.rs, and the relay's 130 tests pass.For deployment: a Linux relay needs
net.core.rmem_maxof at least 4 MiB, or the 4 MiB socket buffer is clamped to the kernel's limit. Only the operator can set that.🤖 Generated with Claude Code