Performance testing measures how a system behaves under defined demand. Start with a clear user flow, workload and success criteria.

Key metrics

MetricMeaning
Response timeTime from request start to response completion.
ThroughputRequests, transactions or data processed per unit of time.
Error ratePercentage or count of failed operations.
Concurrent usersUsers or sessions active at the same time.
PercentileValue below which a percentage of results fall.
SaturationPressure on CPU, memory, connections, queues or another limit.

If checkout p95 is 800 ms, 95% of measured checkouts completed in 800 ms or less. Averages can hide a slow minority, so report percentiles such as p50, p90, p95 and p99.

Workload model

  • Which user journeys and endpoints matter?
  • How many active and concurrent users are realistic?
  • What arrival rate, think time and test-data variation are expected?
  • How long should warm-up, steady state and cool-down last?
  • What response-time, throughput and error thresholds must pass?
  • Which system metrics and logs will be observed?

Common load patterns

Baseline

Small repeatable load for comparison.

Load

Expected normal and peak demand.

Stress

Increase demand to find limits and failure behaviour.

Spike

Sudden rise and fall in traffic.

Soak

Sustained load to find leaks and gradual degradation.

Breakpoint

Gradually increase load until objectives fail.

Simple k6 example

import http from 'k6/http'; import { check } from 'k6'; export const options = { vus: 10, duration: '30s', thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<500'], }, }; export default function () { const response = http.get('https://test.example.com/api/products'); check(response, { 'status is 200': r => r.status === 200, }); } k6 run performance.js

Run and interpret

  1. Use an authorised, production-like environment.
  2. Prepare unique or reusable data deliberately.
  3. Run a baseline before the target load.
  4. Monitor client, application, database and infrastructure.
  5. Repeat the run and compare under similar conditions.
  6. Correlate slow requests with resource limits and logs.
Do not load-test production without explicit approval: a performance test can disrupt users, trigger alerts or create large amounts of data.

Tools

k6 ↗Scriptable load testing with JavaScript.
Apache JMeter ↗GUI and CLI testing for several protocols.
Gatling ↗Code-based load testing and reports.
APM and metricsConnect response results to server behaviour.