Skip to content

Commit

Permalink
chore: added readme and k6 report
Browse files Browse the repository at this point in the history
  • Loading branch information
roopeshh committed Nov 10, 2024
1 parent ee4512c commit feb78d2
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
90 changes: 90 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# k6 Load Testing Setup and Usage

This guide will help you set up and run k6 for load testing on both Windows and macOS. k6 is an open-source load testing tool for testing the performance of your applications.

## Prerequisites

- **Windows**: PowerShell or Command Prompt
- **MacBook**: Terminal
- VS Code or any other IDEs to look at the project structure

## Installation

### Windows

- Visit the [k6 releases page](https://github.com/grafana/k6/releases) and download the latest Windows version.
- Extract the zip file and then add k6 to the path
- Run `k6 version` on Powershell/Command prompt to verify that k6 is installed.

### MacBook

- Install Homebrew(if not already installed)
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
- Run the following command in Terminal:
```bash
brew install k6
```
- Type `k6 version` in Terminal. You should see the installed version of k6.

## Running k6 tests

- On Terminal/Powershell navigate to the directory `k6-load-tests`
- Run the following command to install all the required dependencies:

```bash
yarn install
```

- To run the k6 load tests and get report on the Terminal/Powershell, run the command
```bash
yarn test
```
- If you want to get detailed k6 dashboard html report, run the command
```bash
yarn test:report
```

## About the k6 tests

### Test description

- This test is a simple test that tests how the https://test.k6.io/ website responds when there is a big load.
- The test is configured with three stages, each defining a different load profile for virtual users (VUs):
- Stage 1:
- Duration: 15 seconds
- Target: 200 VUs
- Description: Gradually ramps up the number of VUs from 0 to 200 over the first 15 seconds.
- Stage 2:
- Duration: 15 seconds
- Target: 1000 VUs
- Description: Further increases the load to 1000 VUs over the next 15 seconds, simulating a peak load.
- Stage 3:
- Duration: 30 seconds
- Target: 0 VUs
- Description: Gradually ramps down the number of VUs back to 0 over the final 30 seconds, allowing for a cool-down period.

### Observations

- The load test did have impact on the web application response time. Here is the observation
- The fastest response time was 96ms
- When the load was high the response time went up to 1000ms(1s)
- Average response duration was 140ms
- p90 was around 202 ms
- p95 was around 242 ms
- p99 was around 360 ms
- With the above observations we can say that when the load was going high the response times went high as well

### Response times in modern day web applications

- In the modern day web applications, the response time depends on the industry standards, application type.
- From my experience I would say APIs returning responses
- under 200ms is considered ideal
- 200ms - 1s is good
- anything over 1s need some improvements
- Slower response times can lead to frustration in the users, eventually leaving the platform

### K6 test report

- k6 report that was generated is also committed (`k6-report.html`) so you can see the trends of how was the response time affected as the number of VUs increased and decreased over time.
44 changes: 44 additions & 0 deletions k6-report.html

Large diffs are not rendered by default.

0 comments on commit feb78d2

Please sign in to comment.