how to run load testing via grafana k6
Introduction
When we developed a project then we need against the project to run load testing to measurement application loading for later application monitoring. We can use like wrk
, jmeter
, etc.
but I found an open source k6 from grafana lab.
Installation
Install k6
cli.
k6 installation
Test Types
It is possible to perform many types of tests using k6, each type serving a different purpose.
Each test type is designed to give you different insights about your system.
- Smoke Test: role is to verify that your system can handle minimal load, without any problems.
- Load Test: It’s primarily concerned with assessing the performance of your system in terms of concurrent users or requests per second.: It’s primarily concerned with assessing the performance of your system in terms of concurrent users or requests per second.
- Stress Test and Spike testing: are concerned with assessing the limits of your system and stability under extreme conditions.
- Soak Test: tells you about reliability and performance of your system over an extended period of time.
The important thing to understand is that each test can be performed with the same test script. You can write one script and perform all the above tests with it. The only thing that changes is the test configuration, the logic stays the same.
Different test types will teach you different things about your system and give you the insight needed to understand or optimize performance.
First write smoke testing
1 | import http from 'k6/http'; |
1 | k6 run scripts/smoke.js |