FlameIQ 소개 — Python을 위한 결정론적 성능 회귀 감지
Source: Dev.to
Performance regressions are invisible in code review.
- 매 함수 호출마다 정규식을 다시 컴파일하는 부주의한 리팩터링.
- 새로운 의존성이 p95 latency에 40 ms를 추가함.
- 인덱스가 없는 데이터베이스 쿼리.
None of these show up in a diff. They accumulate silently across hundreds of commits — a 3 ms latency increase here, a 2 % throughput drop there — until they become expensive production incidents.
Type checkers enforce correctness automatically. Linters enforce style automatically. Nothing enforces performance — until now.
FlameIQ 소개
오늘 우리는 FlameIQ v1.0.0을(를) 공개합니다 — 파이썬용 오픈소스, 결정론적, CI‑네이티브 성능 회귀 엔진입니다.
pip install flameiq-core
FlameIQ는 현재 벤치마크 결과를 저장된 기준선과 비교하고, 어떤 메트릭이 설정된 임계값을 초과하면 CI 파이프라인을 실패시킵니다 — 마치 타입 검사기가 타입 오류 시 빌드를 실패시키는 것과 같은 방식입니다.
빠른 시작
단계 1 — 초기화
cd my-project
flameiq init
단계 2 — 벤치마크 실행 및 메트릭 파일 생성
{
"schema_version": 1,
"metadata": {
"commit": "abc123",
"branch": "main",
"environment": "ci"
},
"metrics": {
"latency": {
"mean": 120.5,
"p95": 180.0,
"p99": 240.0
},
"throughput": 950.2,
"memory_mb": 512.0
}
}
단계 3 — 베이스라인 설정
flameiq baseline set --metrics benchmark.json
단계 4 — 모든 PR에서 비교
flameiq compare --metrics current.json --fail-on-regression
출력
Metric Baseline Current Change Threshold Status
────────────────────────────────────────────────────────────────────
latency.p95 2.45 ms 4.51 ms +84.08% ±10.0% REGRESSION
throughput 412.30 231.50 -43.84% ±10.0% REGRESSION
✗ REGRESSION — 2 metric(s) exceeded threshold.
종료 코드 1. 파이프라인 실패. 회귀가 병합 전에 감지되었습니다.
실제 예시: 정규식 회귀 포착
# FAST — original implementation
def clean(text: str) -> str:
text = re.sub(r"[^\w\s]", "", text) # Python caches compiled regex
text = re.sub(r"\s+", " ", text).strip()
return text.lower()
# SLOW — regressed implementation
def clean(text: str) -> str:
punct_re = re.compile(r"[^\w\s]") # recompiled on every call!
space_re = re.compile(r"\s+") # recompiled on every call!
text = punct_re.sub("", text)
text = space_re.sub(" ", text).strip()
return text.lower()
논리는 동일하므로 차이점은 깔끔해 보입니다. FlameIQ는 84 % p95 지연 시간 증가를 감지했으며, 이는 10 % 임계값을 훨씬 초과합니다.
GitHub Actions 통합
- name: Install FlameIQ
run: pip install flameiq-core
- name: Restore baseline cache
uses: actions/cache@v4
with:
path: .flameiq/
key: flameiq-${{ github.base_ref }}
- name: Run benchmarks
run: python run_benchmarks.py > metrics.json
- name: Check for regressions
run: flameiq compare --metrics metrics.json --fail-on-regression
Source: …
핵심 설계 결정
- Deterministic by design – 동일한 입력은 항상 동일한 출력을 생성합니다. 무작위성, 네트워크 호출,
datetime.now()사용이 없습니다. 공기 차단 인프라를 포함한 모든 CI 환경에서 안전합니다. - No vendor dependency – 기준은 로컬 JSON 파일에 있습니다. SaaS 계정, API 키, 텔레메트리 등이 필요하지 않습니다. 성능 데이터는 귀하의 인프라에 그대로 보관됩니다.
- Direction‑aware thresholds – 지연 시간이 증가하면 회귀로 간주하고, 처리량이 감소하면 회귀로 간주합니다. 임계값은 메트릭 유형별로 부호를 인식하므로, 알려진 메트릭에 대해 수동 설정이 필요하지 않습니다.
- Statistical mode – 잡음이 많은 벤치마크 환경에서 FlameIQ는 Mann‑Whitney U 테스트를 임계값 비교와 함께 적용할 수 있습니다. 임계값을 초과하고 결과가 통계적으로 유의미한 경우에만 회귀로 선언됩니다.
- Versioned schema – 메트릭 스키마는 버전이 지정되어 있으며(현재 v1) 공식 사양을 갖추고 있습니다. 임계값 알고리즘 및 통계 방법론은
/specs에 완전히 문서화되어 있습니다.
HTML 보고서
flameiq report --metrics current.json --output report.html
전체 메트릭‑diff 표, 회귀 하이라이트 및 추세 분석이 포함된 독립형 HTML 보고서를 생성합니다. 외부 자산이 없으며 — 오프라인에서도 작동합니다.
구성
flameiq.yaml (created by flameiq init):
thresholds:
latency.p95: 10% # Allow up to 10% latency increase
latency.p99: 15%
throughput: -5% # Allow up to 5% throughput decrease
memory_mb: 8%
baseline:
strategy: rolling_median
rolling_window: 5
statistics:
enabled: false
confidence: 0.95
provider: json
Try the Demo
우리는 실제 Python 라이브러리를 사용하여 전체 회귀‑감지 워크플로를 단계별로 안내하는 데모 프로젝트 flameiq-demo를 만들었습니다:
👉
Links
- PyPI:
- Documentation: docs.io
- Source: https://github.com/flameiq/flameiq-core
- Demo project: https://github.com/flameiq/demo-flameiq
피드백, 이슈, 그리고 기여를 환영합니다. FlameIQ에서 회귀가 발생했거나 우리가 고려하지 않은 사용 사례가 있다면, GitHub에 이슈를 열거나 토론을 시작해 주세요.
Tags: python opensource devtools ci performance