# Performance Tester

> Yük (load) testi, memory leak (bellek kaçağı) tespiti, benchmark analizleri ve performans optimizasyonu.

- Skill: `gktuoktay/performance-tester` (Agent Skill)
- Install (CLI): `npx skillmds@latest add gktuoktay/performance-tester`
- Raw SKILL.md: https://api.skillmd.com/api/skills/gktuoktay/performance-tester/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: GktuOktay (https://skillmd.com/u/gktuoktay)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/gktuoktay/performance-tester

---


# Performance Tester Guidelines

As a Performance Tester, your objective is to ensure the application scales, responds quickly, and utilizes resources efficiently under varying workloads. You identify bottlenecks, measure Web Vitals, and prevent memory leaks.

## Core Concepts

1. **Load Testing**: Verifying the system behavior under expected user load.
2. **Stress Testing**: Pushing the system beyond its limits to find the breaking point and observe how it recovers.
3. **Endurance Testing**: Running steady load for a long period to detect memory leaks and resource degradation.
4. **Benchmarking**: Establishing baselines to compare against future builds to prevent performance regressions.

## Load Testing with k6

k6 is a modern, developer-centric load testing tool using JavaScript.

### Code Example: k6 Load Test Script

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

export const options = {
  stages: [
    { duration: '30s', target: 50 },  // Ramp up to 50 users
    { duration: '1m', target: 50 },   // Stay at 50 users
    { duration: '30s', target: 0 },   // Ramp down to 0 users
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'], // 95% of requests must be below 500ms
    http_req_failed: ['rate<0.01'],   // Error rate must be less than 1%
  },
};

export default function () {
  const res = http.get('https://api.example.com/v1/products');
  
  check(res, {
    'status is 200': (r) => r.status === 200,
    'transaction time OK': (r) => r.timings.duration < 200,
  });
  
  sleep(1); // Think time between requests
}
```

## Measuring Web Vitals

For frontend performance, track Core Web Vitals to measure the real-world user experience.

| Metric | Threshold (Good) | Description |
| :--- | :--- | :--- |
| **LCP (Largest Contentful Paint)** | < 2.5s | Loading performance. When the main content has rendered. |
| **INP (Interaction to Next Paint)** | < 200ms | Responsiveness. Time from interaction to visual feedback. |
| **CLS (Cumulative Layout Shift)** | < 0.1 | Visual stability. Preventing elements from jumping around. |

*Use tools like Lighthouse, PageSpeed Insights, or `web-vitals` npm library to capture these.*

## Detecting Memory Leaks

Memory leaks occur when objects are no longer needed but are not garbage collected.

### Frontend
- Use Chrome DevTools **Memory** tab.
- Take Heap Snapshots before and after a sequence of actions.
- Compare snapshots to see if detached DOM nodes or unreferenced JS objects remain.

### Backend (Node.js Example)
- Monitor memory usage via `process.memoryUsage()`.
- Use `--inspect` flag and connect Chrome DevTools to profile Node.js apps.
- Look for closures retaining large objects or event listeners not being removed.

## Algorithmic & Database Bottlenecks

1. **N+1 Query Problem**: Ensure ORMs are not fetching related data in a loop. Use `.include()` or eager loading.
2. **Missing Indexes**: Profile slow database queries and add appropriate indexes.
3. **Time Complexity**: Review algorithms (e.g., nested loops leading to O(n²)) when processing large datasets.

## Pre-Flight Checklist

- [ ] Is the test environment isolated from production traffic?
- [ ] Are test data records seeded to reflect a production-sized database?
- [ ] Have thresholds been defined (e.g., p95 < 200ms) for success criteria?
- [ ] Are external third-party services mocked out during load testing? (Do not load test services you do not own).
- [ ] Are infrastructure metrics (CPU, Memory, IO) being monitored concurrently with the test?

