Menu
ESC

Nhập từ khóa để tìm kiếm

↑↓ Di chuyển
Enter Mở
ESC Đóng

Đang tải...

Bài 24 — Performance Test Strategy

Test Strategy and QA Leadership Bài 24/60

Performance Test

Goals theo strategy

  • Confirm SLA met (p95 latency < 500ms).
  • Identify bottleneck.
  • Validate scaling.
  • Pre-launch confidence.

Tools comparison

ToolStrengthsWeakness
JMeterGUI, mature, freeHeavy, hard to version
k6JS code, lightweightNewer
GatlingScala, performantLess popular
LocustPython, distributedPython overhead
ArtilleryYAML configLess feature

Test script ví dụ k6

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

export const options = { stages: [ { duration: '30s', target: 100 }, { duration: '2m', target: 100 }, { duration: '30s', target: 0 }, ], };

export default function () { const res = http.get('https://api.vietnamcos.com/courses'); check(res, { 'status 200': (r) => r.status === 200 }); sleep(1); }

Metrics track

  • Response time (avg, p50, p90, p95, p99).
  • Throughput (RPS).
  • Error rate.
  • CPU, memory, disk, network on server.

Common bottleneck

  • DB query slow (missing index).
  • N+1 query.
  • External API blocking call.
  • Memory leak under load.
  • Connection pool exhausted.

VN benchmark

  • E-com normal: 500-5000 RPS.
  • Tết spike: 10× normal.
  • Banking: 100-1000 TPS, p99 < 1s.

Setup

  • Isolated env, not staging shared.
  • Production-like resource (or scaled-down with multiplier).
  • Realistic data volume (1M+ records, not 100).