perf: push socket events host→guest instead of guest wait=0 polling
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Ambito
- networking, performance
Direzione di ricerca
Inizia da crates/execution/src/node_import_cache.rs:4750-4752 e segui le chiamate a net.poll e net.server_poll, inclusi scheduleSocketPoll e il canale di callback dello stream utilizzato per stdio. Poi esamina il percorso di readiness del sidecar da #172. Il lavoro è completato quando gli eventi socket raggiungono il guest senza riarmare il timer e le righe di benchmark agent-os elencate migliorano, senza compromettere il comportamento della rete.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Guest networking pays a ~2–4ms quantum per socket event (accept, data, close), because the embedded node polyfill (crates/execution/src/node_import_cache.rs:4750-4752) calls the net.poll / net.server_poll sync RPCs with waitMs = 0 and paces itself with guest-side setTimeout timers (scheduleSocketPoll). Latency is the guest timer cadence, not sidecar work.
Measured 2026-07-01 (3-layer differential bench, p50, guest VM vs host node — same program):
| op | host node | guest | tax |
|---|---|---|---|
| udp loopback echo | 0.04ms | 21ms | 525× |
| unix-socket echo | 0.24ms | 21ms | 88× |
| unix accept (connect+close) | 0.14ms | 4ms | 29× |
| tcp 64KiB echo | 0.32ms | 6ms | 19× |
| node:http loopback GET | 0.46ms | 5ms | 11× |
Cost scales with event count (one accept = one ~4ms tick; a full echo ≈ 5 events ≈ 21ms), not payload size. Sidecar-side wait improvements (#172, #173) are correct but cold on this path — the guest always passes wait==0, so the sidecar never waits.
Constraint — why not waitMs > 0
The polyfill cannot block: callSync parks the whole V8 isolate. And the sidecar services these RPCs synchronously on a single-thread tokio runtime (new_current_thread().block_on, stdio.rs), so a wait>0 sync RPC would park the entire sidecar event loop and serialize all VM traffic behind it. Event push is the only shape that doesn't block either loop.
Fix direction
Push socket readiness/connection events host→guest asynchronously over the stream-callback channel the bridge already uses for stdio, and have the polyfill resolve pending accepts/reads/writes off those events instead of re-arming timers. The sidecar-side readiness plumbing from #172 (wait_fd_readable_until) already gives the sidecar an efficient way to learn about readiness to forward.
Follow-up (smaller, same theme)
Sidecar-internal waits can also go push-based: e.g. the loopback peer-pairing wait (#173, currently deadline+backoff polling) could subscribe to a socket-table-insert notification, using the same Condvar/Notify + bounded-timeout-fallback pattern as #174.
Regression gates
Standing bench rows in agent-os scripts/benchmarks fuzz-perf lane: net/udp_echo_small, net/unix_echo_small, net/http_loopback_get, net/tcp_*, perf-finding/unix_accept_latency (agentos#1570/#1571).
- Lingua principale
- TypeScript
- Stelle
- 1k
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rivet-dev/dynamic-apps
-
Build cache ignores maxResponseBytes, potentially reusing an outdated response limitForse già presa @Utkarshpandey0001 l’ha presa 20 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
rivet-dev/dynamic-apps#297 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
rivet-dev/dynamic-apps#280 · 2 commenti ·
-
Make agentOS runtime classifier content-based (match Linux exec semantics), not extension-basedForse già presa @mittal-parth l’ha presa 25 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
rivet-dev/dynamic-apps#275 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
rivet-dev/dynamic-apps#272 ·
-
Treat the WASM/WASI build target as cfg(unix) so filesystem tools need no per-tool mode-bit patchesAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
rivet-dev/dynamic-apps#271 ·
Tutte le issue di rivet-dev/dynamic-apps
Issue simili
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
maniator/verticopolis#880 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
siyuan-note/siyuan#20353 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
black-forest-labs/skills#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Albert-Weasker/niubigeo#168 ·
I maintainer di solito rispondono entro 1 giorno