9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
4.8 KiB
4.8 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-efficiency | Efficiency | 10_Wiki/Topics | verified | self |
|
none | A | 0.88 | applied |
|
2026-05-10 | pending |
|
Efficiency
매 한 줄
"매 useful output / resource consumed — 매 latency, throughput, $cost, watt 매 dimension 별 측정". 매 1972 Knuth "premature optimization" warning 후 신중함이 default, 매 2026 cloud cost + carbon footprint + energy efficiency 가 first-class metric.
매 핵심
매 Efficiency dimensions
- Time: latency p50/p95/p99, throughput RPS.
- Space: memory RSS, disk IOPS, network bytes.
- Money: $/request, $/MAU.
- Energy: watt/op, gCO2eq/request.
매 측정 → 개선 cycle
- Profile: hotspot 의 identify (flamegraph).
- Hypothesize: bottleneck 의 type (CPU? IO? Lock?).
- Optimize: targeted change.
- Verify: A/B with baseline, metric 의 statistical sig.
매 응용
- API: cold-start 의 reduce.
- ML inference: quantization, batching, KV cache.
- CI: cache hit rate 의 maximize.
💻 패턴
Latency histogram (Prometheus)
from prometheus_client import Histogram
LATENCY = Histogram('http_request_duration_seconds', 'HTTP latency',
buckets=[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5])
@LATENCY.time()
def handle(req): ...
Cost-per-request rollup
-- BigQuery
SELECT
service,
SUM(billable_seconds * cpu_cost_per_sec) AS compute_usd,
COUNT(*) AS requests,
SUM(billable_seconds * cpu_cost_per_sec) / COUNT(*) AS usd_per_req
FROM service_metrics
WHERE _PARTITIONDATE = CURRENT_DATE() - 1
GROUP BY service
ORDER BY usd_per_req DESC;
CPU flamegraph (py-spy)
# 매 production-safe sampling profiler
py-spy record -o flame.svg -d 60 -p $(pgrep -f gunicorn)
py-spy top -p $(pgrep -f gunicorn)
Memory profiling (memray)
memray run --live ./app.py
memray flamegraph output.bin -o memflame.html
Async IO efficiency
import asyncio, httpx
# BAD — sequential
async def fetch_seq(urls):
async with httpx.AsyncClient() as c:
return [await c.get(u) for u in urls]
# GOOD — concurrent
async def fetch_par(urls):
async with httpx.AsyncClient() as c:
return await asyncio.gather(*[c.get(u) for u in urls])
Carbon-aware scheduling
import httpx
async def carbon_intensity(region: str) -> float:
r = await httpx.AsyncClient().get(
f"https://api.electricitymaps.com/v3/carbon-intensity/latest?zone={region}",
headers={"auth-token": "TOKEN"})
return r.json()["carbonIntensity"] # gCO2eq/kWh
# 매 batch job 매 low-carbon window 의 schedule
async def maybe_run(region):
ci = await carbon_intensity(region)
if ci < 200: await run_batch()
else: await asyncio.sleep(900)
LLM inference batching
from vllm import LLM, SamplingParams
llm = LLM(model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=4,
max_num_seqs=256) # 매 batch 의 throughput
sp = SamplingParams(max_tokens=256)
outs = llm.generate(prompts, sp) # 매 single forward pass 로 batch
Cache efficiency dashboard
# Prometheus query — cache hit ratio
sum(rate(cache_hits_total[5m])) /
(sum(rate(cache_hits_total[5m])) + sum(rate(cache_misses_total[5m])))
매 결정 기준
| 상황 | Approach |
|---|---|
| Latency-critical (real-time) | tail-latency optimize, drop p99 outliers |
| Throughput (batch) | parallelism, vectorize |
| Cost 제약 | spot instance, autoscale, cache |
| Green ops | carbon-aware scheduling, region selection |
기본값: 매 profile-first, 매 measure both before/after, 매 single-dimension fixation 매 X.
🔗 Graph
- 부모: Site Reliability Engineering
- 변형: Latency
- 응용: Flame_Graphs · Profiling
- Adjacent: FinOps · Green Software
🤖 LLM 활용
언제: profile output → bottleneck classification, optimization 후보 ranking. 언제 X: 매 micro-benchmark 매 LLM 의 single-shot 평가 X — 매 측정 우선.
❌ 안티패턴
- Premature optimization: profile 없이 optimize.
- Single-metric obsession: latency 만 보고 cost 폭증.
- Synthetic benchmark: production traffic shape 무시.
- No baseline: 매 before 측정 없이 "fast" 주장.
🧪 검증 / 중복
- Verified (SRE Workbook ch.4, AWS Well-Architected Performance pillar).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — efficiency 4 dimension + measurement loop |