"매 production Node 의 성능 의 V8 heap + event loop + async I/O 의 3-축 의 governing". 매 2026 의 Node 22 LTS 의 default — 매 V8 12.x 의 Maglev/Turbofan tier 의 활용 + native diagnostic_channel + clinic.js 4.x 의 standard toolchain.
매 핵심
매 3-축 model
Heap: 매 V8 의 Old/New Space 의 GC pressure.
Event Loop: 매 microtask + macrotask + nextTick 의 priority.
Async I/O: 매 libuv thread pool (UV_THREADPOOL_SIZE default 4).
매 진단 toolkit (2026)
node --inspect + Chrome DevTools.
clinic.js doctor / flame / bubbleprof / heapprofiler.
0x (flamegraph generator).
node --prof + --prof-process.
diagnostic_channel (Node 16+) — 매 production-safe instrumentation.
매 응용
Memory leak 의 추적 — heap snapshot diff.
CPU bottleneck 의 식별 — flame graph.
Event loop lag 의 monitoring — perf_hooks.monitorEventLoopDelay.
💻 패턴
Heap snapshot 비교
constv8=require('v8');constfs=require('fs');functionsnapshot(label){constfile=`/tmp/heap-${label}-${Date.now()}.heapsnapshot`;conststream=v8.getHeapSnapshot();stream.pipe(fs.createWriteStream(file));returnfile;}// usage
constbefore=snapshot('before');runWorkload();global.gc?.();// --expose-gc
constafter=snapshot('after');// → load both into Chrome DevTools, compare retainers
Event loop delay monitoring
import{monitorEventLoopDelay}from'node:perf_hooks';consth=monitorEventLoopDelay({resolution:20});h.enable();setInterval(()=>{constp99=h.percentile(99)/1e6;// ms
if(p99>100)console.warn(`event loop p99 lag: ${p99.toFixed(1)}ms`);h.reset();},5000);
CPU profile (production-safe)
import{Session}from'node:inspector/promises';constsession=newSession();session.connect();awaitsession.post('Profiler.enable');awaitsession.post('Profiler.start');// ... run workload
const{profile}=awaitsession.post('Profiler.stop');fs.writeFileSync('cpu.cpuprofile',JSON.stringify(profile));