performance-testing
Test application performance with k6 load/stress/soak/spike scripts and k6 scenarios, Lighthouse CI for Web Vitals, and performance budgets as CI gates. Covers load profiles, custom metrics, bottleneck identification, and Core Web Vitals (LCP, INP, CLS). Use when: "performance test," "load test," "stress test," "soak test," "spike test," "k6," "k6 scenarios," "Lighthouse," "Web Vitals," "Core Web Vitals," "performance budget." Not for: scheduled production probes — use synthetic-monitoring; pixel-diff regressions — use visual-testing; designing tests from prod telemetry — use observability-driven-testing. Related: ci-cd-integration, qa-metrics, release-readiness.
kindlmann · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add petrkindlmann/qa-skills --skill performance-testing技能说明
name: performance-testing description: >- Test application performance with k6 load/stress/soak/spike scripts and k6 scenarios, Lighthouse CI for Web Vitals, and performance budgets as CI gates. Covers load profiles, custom metrics, bottleneck identification, and Core Web Vitals (LCP, INP, CLS). Use when: "performance test," "load test," "stress test," "soak test," "spike test," "k6," "k6 scenarios," "Lighthouse," "Web Vitals," "Core Web Vitals," "performance budget." Not for: scheduled production probes — use synthetic-monitoring; pixel-diff regressions — use visual-testing; designing tests from prod telemetry — use observability-driven-testing. Related: ci-cd-integration, qa-metrics, release-readiness. license: MIT metadata: author: kindlmann version: "2.0" category: automation
Quick Route
| You need to... | Go to |
|---|---|
| Test backend capacity / throughput / latency under traffic | k6 Load Testing → references/recipes.md |
| Pick a load shape (constant / ramp / spike / soak) | Load Profiles table |
| Measure frontend speed for real users (LCP, INP, CLS) | Web Performance + Core Web Vitals |
| Gate page perf in CI | Lighthouse CI (gate TBT, not INP — see below) |
| A budget is breached and you must find why | Bottleneck Identification |
| Migrate an existing suite from k6 v1 → v2 | k6 v2 Migration callout |
Discovery Questions
Check .agents/qa-project-context.md first — if it exists, use it and skip questions
already answered there.
What to Measure
- Web performance or load testing? Web performance measures user-perceived speed (Core Web Vitals, page load). Load testing measures server capacity (RPS, latency under load). Most products need both.
- Which user journeys are performance-critical? Not every endpoint needs load testing. Focus on high-traffic, revenue-critical, or latency-sensitive flows.
- Existing performance budgets? If yes, what are the targets? If no, this skill helps establish them — measure baseline first.
Current State
- What is the current baseline? You need numbers before you can set targets. Measure first, then define budgets.
- What broke due to performance before? Slow pages that lost users, endpoints that timed out under load, queries that locked up — these point at where to focus.
- Existing monitoring? APM (Datadog, New Relic), RUM, or synthetic probes give you field data to model realistic load.
Infrastructure
- Where does load testing run? Target staging or a dedicated load-test environment, never production without explicit operations coordination.
- Expected traffic pattern? Steady, daily peaks, seasonal spikes (Black Friday), or event-driven bursts — this picks the load profile.
- Rate limits, WAF rules, or auto-scaling in the path? These distort results and must be accounted for in test design.
Core Principles
1. Measure before optimizing
Performance intuition is unreliable; developers routinely optimize the wrong thing. Profile first, identify the actual bottleneck, then optimize. A profiled 50ms win in the right place beats an assumed 500ms win in the wrong one.
2. Budgets are only real if CI enforces them
A budget documented in a wiki but not checked in CI is violated within weeks. Wire budgets into the pipeline as k6 thresholds and Lighthouse assertions so regressions fail the build, not a quarterly review.
3. Realistic load beats maximum stress
A stress test to 10x traffic tells you the breaking point. A load test at 1.5x expected traffic tells you whether tomorrow's real users have a good experience. Both have value, but realistic load runs more often and catches regressions earlier.
4. Core Web Vitals are what users actually feel
Server-side metrics (latency, throughput) matter, but users experience performance through the browser. LCP, INP, and CLS measure perceived speed. A fast API that renders slowly is still slow to users.
5. Performance is a feature
It does not happen by accident. It needs dedicated test infrastructure, budgets, and monitoring, and the same continuous attention as functional correctness. Treat a performance regression with the same urgency as a functional bug.
k6 Load Testing
k6 is an open-source load testing tool that uses JavaScript/TypeScript for scripts, runs from the CLI, and integrates with CI. Current stable: k6 v2.0.0 (final shipped 2026-05). v2 has breaking changes from v1 — see the migration callout below.
A load test is built from three pieces: a load profile (the stages/scenarios
shape), checks (per-request assertions), and thresholds (pass/fail budgets that
set the exit code). Always drive the base URL from __ENV so the same script runs against
local, staging, and CI.
See references/recipes.md for the full basic load test, custom metrics, and scenarios.
A minimal threshold block:
export const options = {
stages: [
{ duration: '1m', target: 20 },
{ duration: '3m', target: 20 },
{ duration: '1m', target: 0 },
],
thresholds: {
http_req_duration: ['p(95)<500', 'p(99)<1000'],
http_req_failed: ['rate<0.01'],
},
};
Load Profiles
| Profile | Question | Shape | Duration |
|---|---|---|---|
| Constant | Can the system handle normal traffic? | vus: 50, duration: '10m' | 10 min |
| Ramp-up (stress) | At what point does it degrade? | 50 → 100 → 200 → 400 → 800 → 0 | 12 min |
| Spike | Does it recover from a sudden surge? | 50 → spike 500 |