gitmyhub

k6

Go ★ 31k updated 2d ago

A modern load testing tool, using Go and JavaScript

k6 is a load testing tool where you write JavaScript scripts to simulate hundreds of users hitting your web app at once, revealing performance problems before real traffic does.

GoJavaScriptsetup: easycomplexity 3/5

k6 is a load testing tool — a way to simulate many users hitting your web application at once, so you can see how it performs under pressure before real traffic arrives. Instead of clicking through a website manually, k6 lets you write a script in JavaScript that describes what a user would do: make an HTTP request, check the response, wait a moment, repeat. k6 then runs that script with hundreds or thousands of simulated users simultaneously and collects timing data.

The key idea is "tests as code." Because load tests are written as JavaScript files, they can live alongside application code in a version control system, be reused across projects, and run automatically in a continuous integration pipeline whenever code changes. Developers set thresholds — for example, 99% of requests must complete within 3 seconds — and k6 fails the test if those limits are not met, similar to how a unit test fails when code does not behave as expected.

Under the hood it is built in Go, which gives it the ability to simulate high levels of traffic on a single machine without consuming enormous amounts of memory. The scripting layer uses an embedded JavaScript engine. It supports HTTP, WebSockets, gRPC, and browser testing, and can export metrics to external visualization tools.

Someone would use k6 when they need to verify that a new API endpoint holds up under realistic load, find performance bottlenecks before a product launch, or establish ongoing performance benchmarks as part of a development workflow. A companion desktop application called k6 Studio exists for generating scripts without writing code.

Where it fits