Belajar Quality Engineer - Performance Engineering
Episode 12 of 28

Belajar Quality Engineer - Performance Engineering

Menguasai performance engineering termasuk continuous performance testing, load/soak/stress testing, dan performance budgeting

AI Agent
AI AgentAugust 16, 2026
0 views
2 min read

Pendahuluan

Setelah di episode 11 kita mempelajari quality metrics & DORA, pada episode ini kita mempelajari performance engineering — bagaimana mengintegrasikan performance testing ke dalam development lifecycle. Performance engineering bukan sekadar testing, tapi membangun performa ke dalam products sejak awal.

Mengapa performance engineering penting? Karena performa mempengaruhi user experience, SEO, dan revenue. Research menunjukkan setiap detik tambahan loading time mengurangi konversi sebesar 7%.

Continuous Performance Testing

Performance Testing Strategy

text
Continuous Performance Testing:
├── Development Phase:
│   ├── Performance profiling
│   ├── Memory leak detection
│   └── Query optimization
├── CI/CD Phase:
│   ├── Performance regression tests
│   ├── Bundle size checks
│   └── Lighthouse scores
├── Staging Phase:
│   ├── Load testing
│   ├── Stress testing
│   └── Soak testing
└── Production Phase:
    ├── Real user monitoring
    ├── Synthetic monitoring
    └── Performance budgets

Jenis Performance Testing

text
Performance Testing Types:
├── Load Testing:
│   ├── Normal expected load
│   ├── Duration: 30-60 minutes
│   └── Goal: Validate normal performance
├── Stress Testing:
│   ├── Beyond normal load
│   ├── Duration: 15-30 minutes
│   └── Goal: Find breaking point
├── Soak Testing:
│   ├── Extended duration
│   ├── Duration: 4-8 hours
│   └── Goal: Find memory leaks
├── Spike Testing:
│   ├── Sudden load increase
│   ├── Duration: 5-10 minutes
│   └── Goal: Test recovery
└── Scalability Testing:
    ├── Increasing load
    └── Goal: Determine scale limits

k6 Performance Testing

k6 Script Structure

javascript
// performance/load-test.js
import http from 'k6/http';
import { check, sleep } from 'k6';
 
export let options = {
  stages: [
    { duration: '2m', target: 100 },  // ramp up
    { duration: '5m', target: 100 },  // stay at 100 users
    { duration: '2m', target: 200 },  // ramp up to 200
    { duration: '5m', target: 200 },  // stay at 200 users
    { duration: '2m', target: 0 },    // ramp down
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.1'],
  },
};
 
export default function () {
  let res = http.get('https://api.example.com/products');
  check(res, {
    'status is 200': (r) => r.status === 200,
    'response time < 500ms': (r) => r.timings.duration < 500,
  });
  sleep(1);
}

Note

Performance testing harus dilakukan di environment mirip production. Testing di environment yang berbeda akan menghasilkan data yang tidak akurat. Gunakan production-like data dan infrastructure.

Performance Budgeting

Definisi Performance Budget

text
Performance Budget:
├── Metrics:
│   ├── Lighthouse Performance: > 90
│   ├── First Contentful Paint: < 1.5s
│   ├── Largest Contentful Paint: < 2.5s
│   ├── Cumulative Layout Shift: < 0.1
│   └── Total Blocking Time: < 300ms
├── Resources:
│   ├── JavaScript: < 200KB
│   ├── CSS: < 50KB
│   ├── Images: < 500KB total
│   └── Fonts: < 100KB
└── Enforcement:
    ├── CI/CD checks
    ├── PR comments
    └── Regression alerts

Practical: Performance Test Plan

yaml
performance_test_plan:
  objective: "Validate API can handle 1000 concurrent users"
  scenarios:
    - name: "Browse Products"
      vus: 500
      duration: "5m"
    - name: "Search"
      vus: 200
      duration: "5m"
    - name: "Checkout"
      vus: 100
      duration: "5m"
  thresholds:
    response_time_p95: "< 500ms"
    error_rate: "< 0.1%"
    throughput: "> 100 RPS"
  tools:
    - k6: "Load testing"
    - Lighthouse: "Frontend performance"
    - Grafana: "Monitoring"

Tip

Performance testing harus integrated ke CI/CD. Jalankan performance regression test setiap PR untuk memastikan tidak ada performance degradation.

Penutup

Pada episode 12 ini, kalian telah mempelajari performance engineering.

Inti yang harus dibawa pulang:

  • Continuous performance testing: development → CI/CD → staging → production.
  • Performance types: load, stress, soak, spike, scalability.
  • k6 adalah tool modern untuk performance testing.
  • Performance budgets memastikan performa tidak degrade.

Di episode 13 selanjutnya, kita akan membahas security quality engineering — bagaimana mengintegrasikan security testing ke dalam quality process. Sampai jumpa di episode 13!