DEV Community

Cover image for The One Tool That Changed How I Think About API Performance
unni mana
unni mana

Posted on

The One Tool That Changed How I Think About API Performance

API stress testing is broken. Here's how we're fixing it.

Let's be honest for a moment. If you've ever had to run a stress test, you know the drill. You fire up a tool like ab or wrk, squint at a wall of numbers in your terminal, and then... well, then what? You copy-paste the numbers into a document, try to make sense of them, and pray your manager or team can decipher the same cryptic metrics you just spent an hour interpreting.

I've been there, and I felt there had to be a better way. That frustration is exactly why I built GoStress.

It's not just another load-testing tool. It's a simple, open-source CLI utility written in Go that solves a core problem: making performance data not just accessible, but genuinely understandable and actionable.

The Problem with Traditional Stress Tests

When you're testing an API, the most common question isn't just "Can it handle 1,000 requests?" It's, "What does that mean for our users?"

Raw numbers—throughput, latency, error codes—only tell a fraction of the story. They don't visually show you where your system starts to buckle. They don't easily highlight the relationship between latency and success rates.

Many existing tools treat the output of a test as a final, static artifact. You get a summary, maybe a CSV file, and the onus is on you to make it meaningful.

GoStress flips this script. It embraces the idea that a test's report is just as important as the test itself.

The 'Aha!' Moment: One Command to a Full HTML Report

What if, instead of a wall of text, you got a polished, shareable HTML report with interactive charts for reliability, latency, and status codes after every single test run?

That's the core promise of GoStress.

One single command is all it takes:

go run . --url http://your-api.com

That's it. That command will send 10 concurrent requests for 10 seconds to your target and generate a report.json file. But the real magic happens when you add the --formats html flag.

go run . --url http://your-api.com --formats html

Now, you get report.html. Open it in your browser, and you're not looking at raw data. You're looking at a narrative summary with built-in charts for:

Throughput & RPS

Latency Percentiles

HTTP Status Code Distribution

Transport Errors
Enter fullscreen mode Exit fullscreen mode

It turns a complex performance test into a story that anyone can understand. This isn't just a developer tool; it's a bridge for communication with QA, product managers, and stakeholders who need to see the impact of a change.

Power and Simplicity Under the Hood

GoStress is designed to be incredibly easy to use, but it's not simplistic. It's packed with features you'd expect from a robust testing tool, all accessible through clear, well-documented flags.

For instance, you can quickly ramp up a more complex test scenario:

go run . \
--url http://localhost:8080/api/orders \
--c 50 \
--d 30 \
--method POST \
--payload '{"customerId":123}' \
--headers 'Authorization: Bearer token, X-Trace: demo' \
--success-status '200-299,409' \
--rps 200 \
--formats 'json,csv,html' \
--output reports/run-01

This command demonstrates the tool's flexibility:

Precise Control: Fine-tune concurrency (-c), duration (-d), and global RPS limits (--rps).

Real-World Scenarios: Support for POST requests with JSON payloads and custom headers.

Flexible Assertions: Define what constitutes a "successful" request with the --success-status flag. Your API might return a 409 Conflict for a valid business logic case, and now you can count it as a success.

Rich Output: Generate reports in json, csv, and html formats for maximum flexibility.
Enter fullscreen mode Exit fullscreen mode

An Unexpected Game-Changer: The Built-in Dashboard

One of the standout features of GoStress is the built-in web dashboard. You can launch it with a single flag:

go run . --serve-web --web-addr :8088 --dashboard-report report.json

This starts a lightweight, protected web server featuring:

A sign-up and login page

A protected dashboard

APIs to import and view report data
Enter fullscreen mode Exit fullscreen mode

This transforms GoStress from a one-off testing tool into a performance observability platform. You can now:

Share Reports Visually: Let your team access a clean, visual representation of performance data without sending files around.

Compare Runs: By loading different JSON reports, you can view and compare results in a consistent UI.

Centralize Viewing: Use the dashboard to host reports from tests run in CI/CD pipelines.
Enter fullscreen mode Exit fullscreen mode

The Developer Experience (DX) Makes All the Difference

As developers, we know that our tools shape our workflows. A tool that is cumbersome to use often gets used less. GoStress is designed for an exceptional developer experience.

Zero Configuration: It works out-of-the-box with sensible defaults.

Clear and Immediate Output: Whether you're running a quick sanity check or a complex scenario, the feedback is immediate and clear.

Re-Run and Re-Report: You can use the --from-report flag to re-render an existing report.json as a polished HTML or CSV file. This is perfect if you want to visualize historical test results without running a new test.

Single Binary: Being written in Go, it compiles into a single, statically linked binary that's incredibly easy to install and run on any platform (Linux, macOS, Windows).
Enter fullscreen mode Exit fullscreen mode

Real-World Use Cases

CI/CD Pipeline Integration

Imagine integrating GoStress into your CI/CD pipeline. Every time you deploy, you automatically run a stress test and generate an HTML report. This report can be stored as an artifact and viewed by the team, ensuring performance regressions are caught early.
# In your CI pipeline
go run github.com/unnivm/gostress \
--url $STAGING_URL \
--c 100 \
--d 60 \
--rps 500 \
--formats html \
--output reports/deploy-${GITHUB_SHA}

Performance Regression Detection

Use --from-report to re-render historical reports and compare them side-by-side in the dashboard. This makes it easy to spot performance trends over time.
Load Testing Microservices

With support for POST requests, headers, and payloads, GoStress is perfect for testing individual microservices with realistic traffic patterns.

What Sets GoStress Apart

Feature GoStress Traditional Tools
HTML Reports with Charts ✅ Built-in ❌ Manual work needed
Web Dashboard ✅ Included ❌ Requires separate setup
Custom Success Status Codes ✅ Flexible ❌ Usually fixed
Global RPS Limiting ✅ Shared across workers ❌ Often per-worker only
Re-run Reports from JSON ✅ Supported ❌ Not common
Simple CLI Flags ✅ Intuitive ❌ Often complex

Getting Started in 2 Minutes

Clone the repository:
Enter fullscreen mode Exit fullscreen mode

git clone https://github.com/unnivm/gostress.git
cd gostress

Run your first test:
go run . --url https://your-api.com --formats html

Open report.html in your browser and explore the insights.
Enter fullscreen mode Exit fullscreen mode

That's it! No complex setup, no configuration files, no learning curve.

The Open Source Ethos

GoStress is completely free and open-source. It's a tool built for the community, by a developer who was tired of the status quo. The goal is to make effective performance testing accessible to everyone, from indie hackers deploying their first API to enterprise teams managing complex microservices.

What you can do to help:

⭐ Star the repository on GitHub

🐛 Report issues or suggest features

🔧 Contribute code or documentation

📢 Share it with your network

Enter fullscreen mode Exit fullscreen mode




Go Ahead, Give It a Try

The next time you need to stress test your application, give GoStress a shot. It's more than just a tool; it's a new way of thinking about performance testing. It's about spending less time deciphering data and more time understanding your system.

Take the tool for a spin, generate that beautiful HTML report, and see for yourself what a difference it makes.

Repository: https://github.com/unnivm/gostress

Drop your thoughts in the comments below! 👇

GoStress is proudly built with Go. It's simple, it's powerful, and it's free. ❤️

Top comments (0)