moq-net: a joining session costs ~34 ms of relay CPU, mostly announce discovery and driver polling

Abierto
#10,327 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start by locating the named announce and session driver paths, including AnnouncePrefix, AnnounceRun, Discovery, OriginState::snapshot, and lite::session::Driver::poll_protocol; the issue provides no file paths or reproduction command. Profile joins with and without announcements, then trace why discovery and polling run before the first subscription settles. Done means announce discovery is independent of origin contents when unused, or deferred until requested, and the excess driver polling is explained.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

A session joining a relay costs about 34 ms of host CPU, independent of how many sessions are already connected, and most of it is not the QUIC or TLS handshake. At 16.7 joins/s that is 0.57 of a 2-vCPU relay's cores, so the connection count at which the relay's CPU-based shed trips depends on the arrival rate more than on fan-out.

Measurement

  • Relay: moq-relay from moq 62c0ec81, frame-pointer release build, on a 2-vCPU dedicated AMD EPYC 7713 VM (kernel 6.18).
  • Load: moq-bench --fanout chat --fps 1 --frame-size 200 from two generators, each with one 1:N channel, ramping linearly at 8.3 connections/s each (16.7/s total).
  • Steady: 45 s of perf record -F 99 --call-graph fp -a at a constant 3,000 connections and no joins. Host 0.764 cores, relay process 0.648, idle host 0.038, so steady state costs 0.242 host cores per 1,000 connections at 1 msg/s.
  • Ramp: 140 s capture while the ramp went from 915 to 3,077 connections (mean about 2,000). Host 1.096 cores, process 0.984. The steady model gives 0.52 host cores at 2,000 connections, which leaves 0.575 host cores for 16.7 joins/s: about 34 ms per join. Slicing the ramp capture into 10 s bins puts that excess roughly constant from 900 to 3,100 connections.

Ramp minus steady (scaled to the ramp's mean connection count), relay-process cores, each sample assigned to the first category whose frames it contains:

Category (matching frames) Ramp Steady Excess
announce/origin discovery (AnnouncePrefix, AnnounceRun, Discovery, OriginState::snapshot, origin_impl::TableCursor::awaits, Prefixes::overlaps/covering, Snapshot drop) 0.146 0.004 0.141
session accept/setup (server::Handshake, start_lite, accept path) 0.018 0.003 0.015
subscribe request outside TrackRun (SubscribeServe, TrackInfoServe) 0.087 0.017 0.070
subscriber side (SubscriberDriver: UniAccept, end_datagrams) 0.100 0.032 0.068
TrackRun/GroupServe 0.228 0.183 0.045
QUIC driver, crypto, sendmsg 0.149 0.107 0.041
other: mostly lite::session::Driver::poll_protocol and session::Supervisor::poll 0.257 0.084 0.173

Path parsing shows up inside the announce category: CharSearcher::next_match and path::parts::Parts::next take 3.7% and 4.9% of all ramp samples. The viewers announce nothing and subscribe to one named broadcast, so each join is paying to build and drop an origin snapshot and to match prefixes it never uses.

Ask

  • Make a new session's announce discovery cost independent of what the origin holds when the client has not asked for announcements, or defer it until it does.
  • Find out why a newly started session's driver polls so much more than a steady one (the 0.17-core "other" row) before its first subscription settles.

Caveats: perf's sample counts on this VM read 1.4-1.6x the kernel's process ticks, so absolute cores above come from /proc ticks and the samples only provide shares. The steady model is linear from one point (3,000 connections).

(Written by Claude Opus 5.5 with medium)

Lenguaje dominante
Rust
Estrellas
1.6k
Forks
251
Merge medio
10 h 10 min
PR fusionados (30 d)
832

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de moq-dev/moq

Todos los issues de moq-dev/moq

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.