Skip to content
Performance Testing — Explained with Examples

Performance Testing — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Performance testing evaluates how a system behaves under various load conditions, measuring speed, responsiveness, and stability to identify bottlenecks.

Performance testing ensures your application meets speed and stability requirements. It answers questions like: “How many users can this handle?” and “What happens when traffic spikes?”

Types of Performance Testing

Load Testing — simulates expected user traffic to measure response times and throughput under normal conditions.

Stress Testing — pushes beyond normal capacity to find the breaking point.

Spike Testing — sudden, dramatic increases in load to test recovery behavior.

Endurance Testing — sustained load over hours or days to detect memory leaks or degradation.

Example: k6 Load Test

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  stages: [
    { duration: '2m', target: 100 },  // Ramp up to 100 users
    { duration: '5m', target: 100 },  // Stay at 100 for 5 minutes
    { duration: '2m', target: 200 },  // Ramp to 200
    { duration: '5m', target: 200 },  // Stay at 200
    { duration: '2m', target: 0 },    // Ramp down
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'], // 95% of requests under 500ms
    http_req_failed: ['rate<0.01'],   // Less than 1% errors
  },
};

export default function () {
  const res = http.get('https://api.example.com/users');
  check(res, {
    'status is 200': (r) => r.status === 200,
    'response time < 300ms': (r) => r.timings.duration < 300,
  });
  sleep(1);
}
// k6 output
http_req_duration......: avg=245ms  min=120ms  med=230ms  max=890ms
http_req_failed........: 0.3%  ✓ 743821    ✗ 2219
vus....................: 200    min=0     max=200

Real-World Analogy

Performance testing is like stress-testing a bridge. You start with a few pedestrians (10 users), then cars (100), then trucks (1000). You check: does the bridge sway more than expected? Do cracks appear? What happens when a convoy of trucks stops in the middle (spike)? How does the bridge hold up after months of continuous traffic (endurance)?

Key Metrics

MetricWhat It MeasuresGood Target
Response timeTime to complete a request< 500ms (p95)
ThroughputRequests per secondDepends on scale
Error ratePercentage of failed requests< 1%
Resource usageCPU, memory, I/O< 80% under load

Related Terms

Load Balancing, Observability, Rate Limiting, Scalability, API Gateway

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro