Skip to content

thuanvu301103/k6-Performance-Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Performance Testing Suite with k6

This repository contains a modular performance testing framework built with Grafana k6. It is designed to evaluate system stability, scalability, and reliability by simulating various traffic patterns.

Project Structure

The project is modularized to separate testing logic from execution configurations:

/k6-performance-tests
  ├── /scenarios            # Test configurations for different load types
  │    ├── load_test.js     # Normal expected load
  │    ├── stress_test.js   # Testing system limits
  │    ├── spike_test.js    # Sudden traffic bursts
  │    └── soak_test.js     # Long-duration reliability
  ├── /config               # Global thresholds and environment setups
  └── request_logic.js      # Shared user flows and API business logic

Test Types Covered

Test Type Description Goal
Load Test Simulates a constant number of concurrent users Verify if the system meets SLAs
Stress Test Increases load until the system reaches its breaking point Identify maximum capacity and recovery behavior
Spike Test Sudden, extreme surge in users for a very short duration Ensure the system doesn't crash during flash sales/events
Soak Test Constant load maintained for several hours/days Detect memory leaks and resource exhaustion

Prerequisites

  • k6 installed: Download k6
  • Node.js (Optional, for linting or managing dependencies)

How to Run

To execute a specific test, run the following command from the root directory:

# Run a Load Test
k6 run scenarios/load_test.js
# Run a Stress Test
k6 run scenarios/stress_test.js

Thresholds (SLA)

Every test script is equipped with Thresholds to automatically determine success or failure:

  • Success Rate: Over 99% of requests must return a 200 OK status.
  • Latency: 95% of requests (p95) must be completed within 500ms.

Monitoring & Reporting

To visualize results in real-time, you can output the metrics to various backends:

  1. InfluxDB + Grafana
k6 run --out influxdb=http://localhost:8086/k6 scenarios/load_test.js
  1. JSON Output
k6 run --out json=reports/results.json scenarios/load_test.js

About

This repository contains a modular performance testing framework built with Grafana k6. It is designed to evaluate system stability, scalability, and reliability by simulating various traffic patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors