Load and stress test
K6 is an application to load and stress test your infrastructure.
K6 is written in Golang, a modern programming language.
We test AWS
The first time we used K6 was to load-test an AWS infrastructure.
A newly created cloud infrastructure needs to be tested before taking it to production.
How many concurrent visitors can your infrastructure handle? How quickly does it scale up? What happens when the system is overloaded?
- Smoke tests test minimal load and is used to observe whether your system is functioning at all. With a smoke test you can also detect adverse effect of application changes that were just deployed (for example increased latency due to inefficient sql queries).
- A load test exerts typical regular and peak loads on the infrastucture. It is used to measure typical behavior under normal conditions, and tests wether the performance is up to standards.
- A stress test exerts ever increasing pressure on your infrastructure, until it breaks. With a stress test you can determine the critical breakdown point, how the system behaves in this situation, and if and how fast it can recover.
- A soak test exerts an acceptable load over a prolonged period of time. With a soak test you can detect if the system keeps functioning. Maybe external services break down after some time, hard disks run full - that kind of thing.
Wanting to test a newly setup AWS cloud infrastructure, I turned to Golang, my favorite programming language. Then I encountered K6 (written in Golang and available in an open-sourced community edition and a cloud edition).
I quickly saw the community edition featured the most important requirements for the test I wanted to do:
- Schemas to implement the different test types can be scripted.
- Simulation of real life user behaviour can be scripted.
- Individual requests can be fully specified with headers and tokens.
- The scripted test can be saved in a single file for an easy re-run later on.
After reviewing and using the community edition, I decided to look at the cloud version.
K6 Clouds features are impressive and offer great possibilities in reporting, graphs, test comparisons and connectivity.
One significant adantage is that tests configured in the cloud edition, can be used locally in the community edition just by simply copying the script.
This way the cloud configuration can first be tested locally, and adjusted if needed, without running a full test.
For professional use, my workflow is:
- implement a first test locally with the community variant
- review global test result to get an impression of the system
- adjust and fine-tune the load test if needed
- port the test to the K6 cloud edition
- run the cloud tests for production - with extensive reports to present to the client, and if needed regularly run with a preset scheme
Thanks, k6 and Golang!
K6 is an excellent load and testing tool.
Golang is a modern programming language that excels in multitasking. Many network operations are written in Golang, for example Docker and Kubernetes.
Golang is developed by Google to better answer modern requirements than the classic languages.