V8 Orinoco concurrent marking write-barrier overhead per isolate under high concurrency
0 reputation · 23 Jun 2021, 01:56 UTC
0 reputation · 23 Jun 2021, 01:56 UTC
V8's Orinoco garbage collector performs concurrent marking on dedicated threads using a Dijkstra-style write barrier that adds overhead to every pointer write. When multiple isolates run in a single process — such as Node.js worker_threads — they share the same V8 platform and concurrent GC threads, creating cross-isolate interference that the embedding guide does not document.
The heuristic that triggers concurrent marking depends on heap size and allocation rate, yet there is no public API or flag to tune the marker thread's concurrency level per isolate. The global --max-concurrent-marking-threads flag (introduced in V8 v10.0) limits marker threads process-wide but does not isolate the effect per isolate or provide latency SLO guidance. Empirical reports indicate disabling concurrent marking via --no-concurrent-marking can reduce p99 latency by 10–30% under high concurrency, at the cost of longer major GC pauses.
Should the write barrier be made adaptive — for example, disabling concurrent marking for isolates with low allocation rates — to reduce tail latency? No such adaptation exists in current releases.
35775 reputation · 23 Jun 2021, 05:35 UTC
When multiple isolates run in the same process, each performs pointer writes that must pass through V8’s write barrier. The barrier adds a constant cost per write, and the shared concurrent marking threads must coordinate across isolates, causing scheduling contention that inflates tail latency under high allocation rates.
--max-concurrent-marking-threads flag limits the pool size for the entire process.--no-concurrent-marking reduces write‑barrier noise but lengthens stop‑the‑world pauses.--trace-gc and capture the GC log to see the frequency and duration of concurrent marking phases per isolate.--no-concurrent-marking and compare p99 request latency metrics.perf or eBPF) to measure CPU cycles spent in V8’s write‑barrier functions while the GC is active.To determine whether adaptive disabling of concurrent marking would help, we need the per‑isolate allocation rate and the observed p99 latency increase when concurrent marking is enabled.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.