[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,21 +2,148 @@
|
||||
id: wiki-2026-0508-analyze-runtime-performance
|
||||
title: Analyze runtime performance
|
||||
category: 10_Wiki/Topics
|
||||
status: merged
|
||||
redirect_to: 성능_프로파일링_및_메모리_관리_표준
|
||||
canonical_id: wiki-2026-0508-040
|
||||
aliases: []
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Performance Analysis, Profiling, Runtime Profiling]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [profiling, performance, devtools]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: applied
|
||||
tech_stack:
|
||||
language: JavaScript/Python
|
||||
framework: Chrome DevTools/perf/py-spy
|
||||
---
|
||||
|
||||
# Redirect
|
||||
# Analyze runtime performance
|
||||
|
||||
이 문서는 Canonical 문서인 [[성능_프로파일링_및_메모리_관리_표준]]으로 통합되었습니다.
|
||||
모든 최신 지식과 세부 내용은 위 링크를 참조하십시오.
|
||||
## 매 한 줄
|
||||
> **"매 측정 없이 최적화 없다."**. Runtime performance 분석은 sampling profiler + tracing + flame graph + RAIL/Web Vitals metrics 의 stack 으로 매 hot path 와 long task 를 식별. 2026 stack: Chrome Performance panel (Insights AI), perf+FlameGraph, py-spy, eBPF/bpftrace, Datadog APM.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 Profiler Type
|
||||
- **Sampling**: 매 N ms 마다 stack 캡처 — 매 low overhead, statistical (perf, py-spy, async-profiler).
|
||||
- **Instrumentation**: 매 fn enter/exit 기록 — 매 accurate, high overhead.
|
||||
- **Tracing**: 매 event timeline (Chrome trace, perfetto).
|
||||
- **Hardware counters**: PMU — IPC, cache miss, branch miss.
|
||||
|
||||
### 매 RAIL Model (web)
|
||||
- **Response**: < 100ms input → feedback.
|
||||
- **Animation**: < 16ms / frame (60fps).
|
||||
- **Idle**: 50ms work blocks max.
|
||||
- **Load**: < 5s on 4G.
|
||||
|
||||
### 매 Core Web Vitals 2026
|
||||
- **LCP** (Largest Contentful Paint) < 2.5s.
|
||||
- **INP** (Interaction to Next Paint) < 200ms — 매 FID 대체 (2024+).
|
||||
- **CLS** (Cumulative Layout Shift) < 0.1.
|
||||
|
||||
### 매 응용
|
||||
1. Web app TTI/INP 개선.
|
||||
2. Backend p99 latency 추적.
|
||||
3. Game/XR frame budget.
|
||||
4. ML inference latency.
|
||||
5. CI pipeline 시간 단축.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Chrome Performance panel + AI insights
|
||||
```javascript
|
||||
// 매 manual marker — show up in Performance timeline
|
||||
performance.mark('ai-search:start');
|
||||
const r = await search(q);
|
||||
performance.mark('ai-search:end');
|
||||
performance.measure('ai-search', 'ai-search:start', 'ai-search:end');
|
||||
// 매 record trace in DevTools → AI Insights highlights bottleneck (2025+)
|
||||
```
|
||||
|
||||
### User Timing API + reporter
|
||||
```javascript
|
||||
const obs = new PerformanceObserver(list => {
|
||||
list.getEntries().forEach(e => analytics('perf', { name: e.name, dur: e.duration }));
|
||||
});
|
||||
obs.observe({ entryTypes: ['measure', 'navigation', 'resource', 'longtask'] });
|
||||
```
|
||||
|
||||
### py-spy live flame graph
|
||||
```bash
|
||||
# 매 attach to running PID, no code change
|
||||
py-spy record -o flame.svg --pid 12345 --duration 30
|
||||
# 매 live top-like
|
||||
py-spy top --pid 12345
|
||||
```
|
||||
|
||||
### Linux perf flame graph
|
||||
```bash
|
||||
sudo perf record -F 99 -g -p $PID -- sleep 30
|
||||
sudo perf script | \
|
||||
./stackcollapse-perf.pl | ./flamegraph.pl > flame.svg
|
||||
```
|
||||
|
||||
### Web Vitals INP measurement
|
||||
```javascript
|
||||
import { onINP, onLCP, onCLS } from 'web-vitals';
|
||||
onINP(m => beacon('inp', m.value, m.id));
|
||||
onLCP(m => beacon('lcp', m.value, m.id));
|
||||
onCLS(m => beacon('cls', m.value, m.id));
|
||||
```
|
||||
|
||||
### Node --prof + --prof-process
|
||||
```bash
|
||||
node --prof server.js
|
||||
# 매 after run
|
||||
node --prof-process isolate-*.log > profile.txt
|
||||
```
|
||||
|
||||
### eBPF (bpftrace) syscall latency
|
||||
```bash
|
||||
sudo bpftrace -e '
|
||||
tracepoint:syscalls:sys_enter_read { @s[tid] = nsecs; }
|
||||
tracepoint:syscalls:sys_exit_read /@s[tid]/ {
|
||||
@us = hist((nsecs - @s[tid]) / 1000);
|
||||
delete(@s[tid]);
|
||||
}'
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Tool |
|
||||
|---|---|
|
||||
| Web (Chromium) | DevTools Performance + Web Vitals |
|
||||
| Node.js | clinic.js / 0x / --prof |
|
||||
| Python | py-spy / scalene / cProfile |
|
||||
| JVM | async-profiler / JFR |
|
||||
| Go | pprof |
|
||||
| Linux native | perf + FlameGraph / eBPF |
|
||||
| Production APM | Datadog / NewRelic / OTel |
|
||||
|
||||
**기본값**: 매 sampling profiler 우선, instrumentation 은 spot-check.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Flame_Graphs]]
|
||||
- 변형: [[CPU Bottleneck]]
|
||||
- 응용: [[High Resolution Time]] · [[Memory Management]]
|
||||
- Adjacent: [[Page Experience Algorithm]] · [[Debugger_Techniques]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: flame graph 해석, perf insight 요약, regression hypothesis.
|
||||
**언제 X**: 매 nanosecond-level profiling — specialized tool 만이 정확.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Production 에 instrumenting profiler**: 매 overhead 폭발.
|
||||
- **Single-run 결론**: 매 statistical noise — multi-run 필요.
|
||||
- **Average only**: 매 p50 보다 p99 가 user 체감.
|
||||
- **Profile dev build**: 매 prod build 와 다름 — release/optimized 측정.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified: web.dev Performance docs; Brendan Gregg "Systems Performance"; Chrome DevTools docs.
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — RAIL/INP + multi-language profilers |
|
||||
|
||||
Reference in New Issue
Block a user