Mid-LevelPerformance & Load Testing
Explain how you would use k6 for performance testing.
- k6
- scripting
- load testing tool
Answer it first, then compare. Nothing here is saved or scored.
Model answer
k6 uses JavaScript for test scripts. Key concepts: (1) Virtual Users (VUs) simulate concurrent users. (2) Stages define ramp-up/down patterns. (3) Checks are assertions (status code, response time). (4) Thresholds define pass/fail criteria (p95 < 500ms). (5) Groups organize requests into logical transactions. (6) Tags enable filtering results by endpoint/feature. Typical script: export options with stages, export default function with http.get/post calls and checks. Run with k6 run script.js or k6 cloud for distributed load.
What interviewers listen for
- Workload modellingYou design the load shape from product traffic, not from tool defaults.
- Percentile literacyYou read p50/p95/p99 separately and explain why each matters.
- Bottleneck triageYou correlate metrics across application, database, and infrastructure layers.
- Capacity instinctsYou can translate a soak test into a sizing or scaling recommendation.