This project provides practical examples of different types of performance testing using JavaScript and k6, an open-source load testing tool. The scripts included in this repository demonstrate how to perform load testing, stress testing, spike testing, soak testing, and scalability testing on web applications or APIs.
This project aims to provide hands-on examples of various performance testing techniques using k6. The scripts are designed to simulate different load scenarios, helping you assess how your application performs under various conditions.
Load testing is designed to understand how your system behaves under a specific expected load. This involves simulating a typical number of users accessing the application simultaneously to ensure that it can handle everyday traffic smoothly. The goal is to identify any performance bottlenecks before they affect real users.
Stress testing pushes your system to its limits to understand its breaking point and how it fails under extreme conditions. This can help identify bottlenecks and performance issues that only appear when the system is under significant stress.
Spike testing evaluates how your system handles sudden, intense increases in load. This is crucial for understanding how your application responds to unexpected traffic spikes, such as during a flash sale or a breaking news event.
Soak testing involves running your system under a significant load for an extended period. This helps identify issues like memory leaks, resource leaks, and performance degradation over time that could affect the long-term reliability of your application.
Scalability testing determines how well your system scales with increasing loads. It helps to understand whether your application can handle growth in user numbers or transaction volumes and at what point additional resources or optimizations might be needed.
To run these performance tests, you need to have k6 installed on your system.
brew install k6
choco install k6
Alternatively, you can download k6 directly from the official website.
Each script in this repository is named according to the type of performance test it conducts. To execute a specific test, use the following command:
k6 run <script-name.js>