Files
2nd/10_Wiki/Topics/Architecture/Orinoco.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

4.9 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-orinoco Orinoco (V8 GC project) 10_Wiki/Topics verified self
V8 Orinoco
Orinoco GC
Concurrent V8 GC
none A 0.9 applied
v8
gc
performance
concurrent-marking
runtime
2026-05-10 pending
language framework
cpp v8

Orinoco

매 한 줄

"매 V8의 GC를 stop-the-world에서 incremental · concurrent · parallel multi-threaded GC로 전환한 multi-year 프로젝트.". 2016년 시작, 2017-2019 Concurrent Marking · Parallel Scavenger · Lazy Sweeping 차례 도입. 2026 현재 V8 13.x base GC architecture가 Orinoco — pause time을 100ms+ → <1ms로 감소.

매 핵심

매 핵심 기법

  • Parallel Scavenger (Young Gen): 매 multiple worker가 semi-space copy 병렬화.
  • Concurrent Marking (Old Gen): 매 worker thread가 mutator와 병행 mark — main thread는 거의 미 pause.
  • Incremental Marking: 매 mark phase를 여러 작은 chunk로 나눔.
  • Parallel/Concurrent Compaction: page별 evacuation 병렬화.
  • Lazy Sweeping: 매 sweep을 allocation 시점까지 지연.
  • Black Allocation: 매 marking 중 새 alloc은 black (skip).

매 write barrier 역할

  • 매 mutator가 마크된 object → 비마크 object 참조 추가 시 dirty card 표시.
  • 매 concurrent marker가 stale graph 처리.

매 응용

  1. Chrome — main thread jank 감소, smooth 60fps scroll.
  2. Node.js — large heap server에서 long pause 제거.
  3. Electron/VSCode — GUI responsiveness 유지.

💻 패턴

Orinoco effect 측정 (Node.js)

# Major GC pause 분포
node --trace-gc --trace-gc-verbose app.js 2>&1 \
  | grep "Mark-" | awk '{print $5}' \
  | sort -n | uniq -c
# 2026 V8: 대부분 < 1ms, occasional 5ms

Disable concurrent marking (compare)

node --no-concurrent-marking --trace-gc app.js
# pause time 명백히 증가 (10-50ms 종종)

Per-isolate GC stats

import { getHeapStatistics } from 'node:v8';

const before = getHeapStatistics();
heavyWorkload();
const after = getHeapStatistics();
console.log('major_gc count:', after.number_of_native_contexts);
console.log('used:', (after.used_heap_size - before.used_heap_size) / 1e6, 'MB');

Performance.measureUserAgentSpecificMemory (Chrome)

// In Chrome with COOP+COEP
if (performance.measureUserAgentSpecificMemory) {
  const result = await performance.measureUserAgentSpecificMemory();
  console.log(result.bytes, result.breakdown);
}

Reduce concurrent-marking pressure

// Avoid: huge graph mutation in tight loop
function reseat(arr, n) {
  for (let i = 0; i < n; i++) arr[i] = { ref: arr[(i+1) % n] };
  // many write barriers → marker work spike
}
// Prefer: build once, freeze
const frozen = Object.freeze(buildGraph());

Inspect GC marking phase via perf_hooks

import { PerformanceObserver } from 'node:perf_hooks';

const obs = new PerformanceObserver(list => {
  for (const e of list.getEntriesByType('gc')) {
    if (e.detail.kind === 2 /* MARK_SWEEP_COMPACT */)
      console.log('major GC:', e.duration.toFixed(2), 'ms');
  }
});
obs.observe({ entryTypes: ['gc'] });

매 결정 기준

상황 Approach
Long pause complaint (UI jank) check Orinoco enabled (default), profile
Embedded V8 (custom flags) enable concurrent + incremental marking
Constrained memory (IoT) might disable concurrent (extra worker thread)
Benchmarking report w/ default flags + GC trace

기본값: 매 default flags (Orinoco on) — 매 manual disable 회피.

🔗 Graph

🤖 LLM 활용

언제: V8 GC internals 학습, Node.js/Chrome perf 분석, GC pause 회귀 추적. 언제 X: non-V8 runtime (Hermes는 별도 GC), Java/Go GC (G1/ZGC/Shenandoah는 다른 design).

안티패턴

  • Disabling concurrent marking blindly: 매 measurement 없이 — 보통 perf 악화.
  • Huge mutation in hot loop: 매 write barrier overload.
  • Forcing global.gc() 빈번: 매 production 절대 X — Orinoco가 알아서 함.
  • Confusing minor (scavenge) and major (mark-sweep): 매 trace 해석 오류.

🧪 검증 / 중복

  • Verified (V8 blog "Orinoco" series 2016-2019, V8 source src/heap/, Mathias Bynens & Benedikt Meurer talks 2017-2020).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — Orinoco GC project (concurrent/parallel/incremental)