performance-test
2
总安装量
2
周安装量
#74843
全站排名
安装命令
npx skills add https://github.com/shaul1991/shaul-agents-plugin --skill performance-test
Agent 安装分布
opencode
2
gemini-cli
2
antigravity
2
claude-code
2
github-copilot
2
codex
2
Skill 文档
Performance Test Agent
ìí
ì í리ì¼ì´ì ì ì±ë¥ì 측ì íê³ ìµì í í¬ì¸í¸ë¥¼ ìë³í©ëë¤.
ì±ë¥ í ì¤í¸ ì í
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â ì±ë¥ í
ì¤í¸ í¼ë¼ë¯¸ë â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¤
â â
â /\ â
â / \ â
â / ë¶í \ â Stress/Load Test â
â / í
ì¤í¸ \ (ìì¤í
íê³ íì¸) â
â /----------\ â
â / ì±ë¥ \ â Performance Test â
â / í
ì¤í¸ \ (ìëµ ìê°, ì²ë¦¬ë) â
â /--------------\ â
â / íë¡ í¸ìë \ â Frontend Performance â
â / ì±ë¥ 측ì \ (Lighthouse, CWV) â
â /------------------\ â
â â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Frontend ì±ë¥ 측ì
Lighthouse
# CLI ì¤í
npx lighthouse https://example.com --output=json --output-path=./lighthouse-report.json
# í¹ì ì¹´í
ê³ ë¦¬ë§
npx lighthouse https://example.com --only-categories=performance,accessibility
# 모ë°ì¼/ë°ì¤í¬í±
npx lighthouse https://example.com --preset=desktop
npx lighthouse https://example.com --preset=mobile
# CI íµí©
npx lhci autorun
Lighthouse CI ì¤ì
// lighthouserc.js
module.exports = {
ci: {
collect: {
url: ['http://localhost:3000/', 'http://localhost:3000/products'],
numberOfRuns: 3,
},
assert: {
assertions: {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
'categories:best-practices': ['error', { minScore: 0.9 }],
'categories:seo': ['error', { minScore: 0.9 }],
'first-contentful-paint': ['error', { maxNumericValue: 1500 }],
'largest-contentful-paint': ['error', { maxNumericValue: 2500 }],
'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }],
'total-blocking-time': ['error', { maxNumericValue: 200 }],
},
},
upload: {
target: 'temporary-public-storage',
},
},
};
Core Web Vitals 기ì¤
| ì§í | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | ⤠2.5s | ⤠4.0s | > 4.0s |
| FID (First Input Delay) | ⤠100ms | ⤠300ms | > 300ms |
| CLS (Cumulative Layout Shift) | ⤠0.1 | ⤠0.25 | > 0.25 |
| INP (Interaction to Next Paint) | ⤠200ms | ⤠500ms | > 500ms |
| TTFB (Time to First Byte) | ⤠800ms | ⤠1800ms | > 1800ms |
Web Vitals 측ì ì½ë
// src/utils/web-vitals.ts
import { onCLS, onFID, onLCP, onTTFB, onINP } from 'web-vitals';
const sendToAnalytics = (metric: any) => {
console.log(metric);
// ë¶ì ìë¹ì¤ë¡ ì ì¡
};
export const measureWebVitals = () => {
onCLS(sendToAnalytics);
onFID(sendToAnalytics);
onLCP(sendToAnalytics);
onTTFB(sendToAnalytics);
onINP(sendToAnalytics);
};
Backend ì±ë¥ í ì¤í¸
k6 Load Test
// load-test.js
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
// ë¨ê³ë³ ë¶í
stages: [
{ duration: '1m', target: 50 }, // Ramp up
{ duration: '3m', target: 50 }, // Steady state
{ duration: '1m', target: 100 }, // Spike
{ duration: '2m', target: 100 }, // Steady high
{ duration: '1m', target: 0 }, // Ramp down
],
// ì±ë¥ 기ì¤
thresholds: {
http_req_duration: ['p(95)<500'], // 95% ìì²ì´ 500ms ì´ë´
http_req_failed: ['rate<0.01'], // ì¤í¨ì¨ 1% 미ë§
http_reqs: ['rate>100'], // ì´ë¹ 100 ìì² ì´ì
},
};
export default function () {
// API í¸ì¶
const response = http.get('http://localhost:3000/api/users');
// ê²ì¦
check(response, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
});
sleep(1);
}
// ìëë¦¬ì¤ ê¸°ë° í
ì¤í¸
export function scenario() {
const loginRes = http.post('http://localhost:3000/api/auth/login', {
email: 'test@test.com',
password: 'password',
});
const token = loginRes.json('token');
const usersRes = http.get('http://localhost:3000/api/users', {
headers: { Authorization: `Bearer ${token}` },
});
check(usersRes, {
'users fetched': (r) => r.json('data').length > 0,
});
}
k6 ì¤í
# 기본 ì¤í
k6 run load-test.js
# VU(Virtual Users) ì§ì
k6 run --vus 10 --duration 30s load-test.js
# ê²°ê³¼ ì¶ë ¥
k6 run --out json=results.json load-test.js
# Cloud ì¤í
k6 cloud load-test.js
Artillery í ì¤í¸
# artillery-config.yml
config:
target: 'http://localhost:3000'
phases:
- duration: 60
arrivalRate: 10
name: "Warm up"
- duration: 120
arrivalRate: 50
name: "Sustained load"
- duration: 60
arrivalRate: 100
name: "Peak load"
defaults:
headers:
Content-Type: 'application/json'
scenarios:
- name: "User flow"
flow:
- get:
url: "/api/products"
capture:
- json: "$.data[0].id"
as: "productId"
- post:
url: "/api/cart"
json:
productId: "{{ productId }}"
quantity: 1
expect:
- statusCode: 201
- get:
url: "/api/cart"
expect:
- statusCode: 200
# Artillery ì¤í
artillery run artillery-config.yml
# 리í¬í¸ ìì±
artillery run --output results.json artillery-config.yml
artillery report results.json
ì±ë¥ ê¸°ì¤ ì ì
## ì±ë¥ ì구ì¬í
### API ìëµ ìê°
| ìëí¬ì¸í¸ | P50 | P95 | P99 |
|-----------|-----|-----|-----|
| GET /api/users | < 100ms | < 300ms | < 500ms |
| POST /api/users | < 200ms | < 500ms | < 1s |
| GET /api/products | < 150ms | < 400ms | < 800ms |
### ì²ë¦¬ë (Throughput)
- ìµì: 100 RPS
- 목í: 500 RPS
- í¼í¬: 1000 RPS
### Frontend
| ì§í | 목í |
|------|------|
| LCP | < 2.5s |
| FID | < 100ms |
| CLS | < 0.1 |
| Lighthouse Score | > 90 |
### ìë¬ì¨
- 목í: < 0.1%
- íì©: < 1%
CI íµí©
# .github/workflows/performance.yml
name: Performance Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run build
- run: npm start &
- name: Lighthouse CI
run: npx lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
load-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run k6 tests
uses: grafana/k6-action@v0.3.1
with:
filename: tests/load/load-test.js
flags: --out json=results.json
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: k6-results
path: results.json
리í¬í¸ í í릿
# ì±ë¥ í
ì¤í¸ 리í¬í¸
## í
ì¤í¸ ì ë³´
- ë ì§: 2024-01-15
- íê²½: Staging
- ë²ì : v1.2.0
## Frontend ì±ë¥ (Lighthouse)
### Desktop
| íì´ì§ | Performance | Accessibility | Best Practices | SEO |
|--------|------------|---------------|----------------|-----|
| Home | 95 | 100 | 100 | 100 |
| Products | 88 | 98 | 100 | 95 |
| Checkout | 82 | 95 | 92 | 100 |
### Mobile
| íì´ì§ | Performance | LCP | FID | CLS |
|--------|------------|-----|-----|-----|
| Home | 78 | 2.1s | 45ms | 0.05 |
| Products | 65 | 3.2s | 120ms | 0.12 |
## Backend ì±ë¥ (k6)
### ë¶í í
ì¤í¸ ê²°ê³¼
| ì§í | ê²°ê³¼ | 목í | ìí |
|------|------|------|------|
| P95 ìëµìê° | 320ms | < 500ms | â
|
| P99 ìëµìê° | 480ms | < 1s | â
|
| ì²ë¦¬ë | 450 RPS | > 100 RPS | â
|
| ìë¬ì¨ | 0.05% | < 1% | â
|
### ìì¸ ê²°ê³¼
http_req_duration: avg: 125ms min: 12ms med: 98ms max: 890ms p(90): 250ms p(95): 320ms
http_reqs: 27000 total, 450/s
## ë³ëª©ì ë¶ì
1. Products íì´ì§ LCP ê°ì íì
2. Checkout íì´ì§ Performance ì ì í¥ì íì
## ê¶ì¥ì¬í
1. ì´ë¯¸ì§ ìµì í (WebP ì ì©)
2. ì½ë ì¤í리í
ì ì©
3. API ìëµ ìºì± ëì
ì°ì¶ë¬¼ ìì¹
- Lighthouse 리í¬í¸:
docs/features/<기ë¥ëª >/test-results/lighthouse-report.html - k6 ê²°ê³¼:
docs/features/<기ë¥ëª >/test-results/k6-results.json - ì±ë¥ 리í¬í¸:
docs/features/<기ë¥ëª >/test-results/performance-report.md