Introduction
Performance testing techniques have become more and more popular in software development in recent years. Along with this rapid growth, there are many good tools which have been being developed to serve for various performance testing purposes.
Within this blog I am going to introduce you K6, an excellent performance testing tool that has been widely used by tester community because of its open-source, ease of use (if you have programming skills), high performance, distributed testing support and detail reporting.
Non-GUI and Open-source scripting language
K6 is an open-source testing tool released in 2017. It is written in Go, but scripts are written in JavaScript which makes them simple to write and execute. All things testers need are any terminal and text editor applications. It means that for testers who were already good at programming it will reduce time significantly in starting testing. Nevertheless, those who do not have language programming knowledge will find it difficult to get familiar with at the beginning.
K6 does not have GUI included in the tool by default, therefore, there are no additional resources consumed during test execution and no impacts on the results. However, if the testers want a graphic interface, then K6 Test Builder is available for free (Labs, Test builder, 2023).
Open-source and K6 Cloud
With K6 open-source testers must do all things by themselves from installation, administration, maintenance etc., while with K6 Cloud they do not need to do anything, just sign-up then login and start using the services immediately. Cloud version, of course, provides a lot of functionalities and services that open-source does not have such as automatic Test Distribution across multiple geo locations, automatic Scale-up, Result analysis etc. (Labs, Comparing k6 OSS and Grafana K6 Cloud, 2023) and with that superior advantages K6 Cloud is not completely free. The highest package of K6 Cloud is about 299$ a month plus usage, however K6 manufacturers also provide Cloud version which is free with limited usage that the testers can try before making decision of buying other paid versions. (Labs, Pricing, 2023)
Key features and Performance
Same as most of other performance testing tools, K6 also supports testers to simulate real-world scenarios by creating complex scenarios that imitate the behavior of real users. Some key features that K6 have are CLI tool with developer-friendly APIs, Scripting in JavaScript ES2015/ES6 with support for local and remote modules, Checks and Thresholds for goal-oriented, automation-friendly load testing (Labs, K6 documentation, 2023). K6 also supports distributed load testing mode via a Kubernetes operator ‘K6 Operator’ which allows testers to create a k6 custom resource object within a Kubernetes cluster.
High performance is also one of the strong points of K6. One single instance can handle 30.000 to 40.000 virtual users (VUs) and in some cases this number of VUs can generate up to 300,000 HTTP requests per second. To have this impressive numbers the hardware and network connection, of course, are configured and setup appropriately. (Labs, Running large tests, 2023).
Protocol Support and CI/CD Integration
K6 only supports HTTP, gRPC, SOAP / REST Webservices and WebSocket Protocols by default when comparing with other similar tools. However, this limitation can be reduced with addon xk6 which provides more protocols such as SMTP, STOMP, WAMP, Ethereum, SSH etc.
Besides, K6 can be integrated with CI/CD tools such as Jenkins, CircleCI and GitLab, that make it easy to include performance testing into development process.
An example of executing K6 test scripts on Command Prompt
I have a K6 script written in Note Pad ++ which is very popular text editor.

Then in Microsoft Command Prompt, I will navigate to the folder storing the test script above and type the command to execute it.

Depend on the codes written in the test scripts, you will be able to view the logs as well as the processes which are being executed.

After the test finishes, K6 prints the full details and summary statistics of the test metrics. Each metric provides a different perspective on performance.

Besides, K6 also provides flexibility to show the results on graphical overview, visualize the CSV output with spreadsheets or even stream the results in some structured formats such as Prometheus remote write or frontend tool, such as Grafana. (Labs, Results output, 2023)
Things that K6 does not
K6 is a high-performance testing tool, scriptable in JavaScript. So, to have this capability there are some things that have been traded-off: K6 does not run natively in a browser and does not run in NodeJS.
Conclusion
If you already had language programming knowledge and want to find a testing tool with high performance, flexibility, ease of use, and extensive documentation, then K6 is an excellent choice.
References
Labs, G. (2023). Comparing k6 OSS and Grafana Cloud k6. Retrieved from Comparing k6 OSS and Grafana Cloud k6: https://k6.io/oss-vs-cloud/
Labs, G. (2023). K6 documentation. Retrieved from K6 documentation: https://k6.io/docs/
Labs, G. (2023). Pricing. Retrieved from Pricing: https://grafana.com/pricing/?src=k6io
Labs, G. (2023). Results output. Retrieved from Results output: https://k6.io/docs/get-started/results-output/
Labs, G. (2023). Running large tests. Retrieved from Running large tests: https://k6.io/docs/testing-guides/running-large-tests/ Labs, G. (2023). Test builder. Retrieved from Test builder: https://k6.io/docs/test-authoring/test-builder/