When it comes to analyzing the performance and scalability of our APIs and web services, we need tools that are not only blazing fast but also easy to configure and integrate into our modern workflows.
Classic tools like ab (Apache Bench) or wrk have been the standard for years, and more modern options like Vegeta or K6 have brought a lot of value. However, today I want to talk to you about Goku, an HTTP load testing application written in Rust that combines extreme performance, simplicity, and modern features like support for the Model Context Protocol (MCP).
In this article, we will explore what makes Goku special, all its features in detail, and practical examples so you can start using it today in your projects.
Why Goku?
Goku stands out for several key reasons:
- Performance and Scalability: Being written in Rust, Goku makes the most out of machine resources, allowing you to generate massive loads of traffic with minimal memory and CPU consumption.
- Simplicity: You can launch complex tests directly from the command line (CLI) or define elaborate scenarios in YAML files.
- Versatility: It supports HTTP/1.1 and HTTP/2, authentication (Bearer and Basic), and constant-rate load profiles (limiting requests per second).
- AI Integration (MCP): It is one of the first tools of its kind to offer an integrated MCP server, which means you can ask an AI agent (like Claude or ChatGPT) to run load tests and analyze the results for you.
Installation
Installing Goku is very simple. You have several options:
Automatic Installation (Linux, macOS, WSL):
curl -sSL https://raw.githubusercontent.com/jcaromiq/goku/v3.0.0/scripts/install.sh | sh
Using Cargo (Rust package manager):
cargo install goku-bench
Practical Examples and Main Features
Let’s see how to use Goku on a daily basis, from the most basic to advanced scenarios.
1. Basic Load Testing
The easiest way to use Goku is via the command line, specifying the target (--target), the concurrency (--clients or -c), and the number of iterations (--iterations or -i).
# Launch 1000 requests in total, using 50 concurrent clients
goku -c 50 -i 1000 --target "GET http://localhost:3000/api/users"
If you prefer to run the test for a given duration instead of a fixed request count, you can use --duration (-d):
# Keep 50 concurrent clients attacking the API for 60 seconds
goku -c 50 --duration 60 --target "GET http://localhost:3000/api/users"
2. Traffic Control (Rate Limiting and Ramp-Up)
Sometimes you don’t want to overwhelm the server all at once, or you want to test how it behaves under a specific constant load.
Constant Rate (RPS):
To limit the maximum number of requests per second across all clients, use --rps:
# 20 clients, 60 seconds, strictly limited to 200 requests per second
goku -c 20 --duration 60 --rps 200 --target http://localhost:3000
Ramp-Up (Gradual start):
To simulate a gradual traffic spike, spread the start of clients over time with --ramp-up:
# 100 clients that will start gradually over 10 seconds
goku -c 100 -i 5000 --ramp-up 10 --target http://localhost:3000
3. Complex Requests (Headers, Body, and Auth)
Goku supports complex HTTP requests. You can add headers, send request bodies, and handle authentication easily.
Sending a Payload (JSON):
goku -c 50 -i 1000 \
--headers "Content-Type:application/json" \
--request-body payload.json \
--target "POST http://localhost:3000/api/orders"
Built-in Authentication: Goku has dedicated flags to inject common authorization headers:
# Using Bearer Token (very common in modern APIs)
goku --auth-bearer "eyJhbGciOiJIUzI1NiIsIn..." --target http://api.example.com/protected
# Using Basic Auth
goku --auth-basic "admin:secret_password" --target http://api.example.com/admin
4. Advanced Scenarios with YAML
For more sophisticated tests, especially those involving user flows (multi-step), it is much cleaner to use a YAML file via the --scenario flag.
A scenario file allows you to define sequences of requests and use dynamic variables.
example_scenario.yaml:
clients: 20
duration: 60
ramp_up: 5
live_stats: 10 # Shows partial metrics in console every 10s
steps:
# Step 1: Get a list
- target: "GET http://api.example.com/users"
# Step 2: Create a record using variable templating
- target: "POST http://api.example.com/orders"
headers:
- key: "Content-Type"
value: "application/json"
# Using built-in variables: {{uuid}}, {{seq}}
body: '{"id": "{{uuid}}", "item": "widget", "sequence": {{seq}}}'
To execute this scenario:
goku --scenario example_scenario.yaml
Available Template Variables: Goku dynamically injects variables into URLs and request bodies for each execution:
{{uuid}}: Genera a unique v4 UUID.{{seq}}: A global sequential number.{{timestamp}}: Current timestamp.{{client}}: The current worker/client ID number.{{random_int(min,max)}}: A random integer between a range. Ex:{{random_int(1,500)}}
5. Results Analysis and Comparisons
Goku shines in the way it presents information. By default, it shows a plain text report with an ASCII latency histogram, percentiles (p50, p95, p99), and status code breakdown.
Concurrency level 50
Time taken 4 seconds
Total requests 1000
Requests/sec 250.00 req/s
Mean 169.90 ms
p50 (median) 155 ms
p95 319 ms
p99 360 ms
Status codes
2xx 998
5xx 2
Latency distribution
10ms ████████████████████████████████████████ 450
25ms █████████████████████████ 280
200ms ████████ 80
Data Export: To integrate it into CI/CD processes, you can export the results to JSON or CSV:
goku -c 50 -i 1000 --output json --output-file results.json --target http://localhost:3000
If you need detailed data for every single request to analyze them in external tools, use --results-log to generate a CSV with all requests (timestamp, status, latency).
Version Comparison (Performance A/B Testing):
Goku includes a compare subcommand that is pure gold when you are optimizing code. You can run a test before your changes, another after, and ask Goku to show you the exact difference:
# 1. Baseline test (main branch)
goku -c 50 -i 1000 --output json --output-file before.json --target http://localhost:3000
# ... you deploy your new optimized version ...
# 2. Candidate test
goku -c 50 -i 1000 --output json --output-file after.json --target http://localhost:3000
# 3. Compare
goku compare before.json after.json
6. The Revolution: MCP Integration for AI Agents
What really separates Goku from other tools is its forward-looking vision. Goku includes an MCP (Model Context Protocol) server.
This means you can connect Goku to tools like Claude Desktop or any MCP-compatible agent. Once connected, instead of typing commands in the terminal, you can simply chat with the AI:
“Run a load test against https://api.example.com/users with 50 concurrent clients for 30 seconds and tell me if the 95th percentile exceeds 200ms.”
The AI agent will invoke Goku’s run_benchmark tool, execute the test on your machine, read the response JSON, and give you a natural language analysis of the result.
To install Goku’s MCP server:
curl -sSL https://raw.githubusercontent.com/jcaromiq/goku/v3.0.0/scripts/install_mcp.sh | sh
# Or via cargo: cargo install goku-mcp
Summary
Goku is a fantastic addition to the testing tools ecosystem. Written in Rust to ensure raw performance, it provides the flexibility of YAML scenarios for complex tests, facilities for CI/CD with JSON/CSV outputs, and a pioneering integration with AI agents via MCP.
If you are working on API optimization or need to ensure the resilience of your services, I highly recommend giving Goku a try in your next project.