Preface
Every backend engineer keeps a few load testing tools handy in their toolbox. When we want to quickly check the performance of an API, ab
is often the first tool we reach for. If we’re chasing maximum single-machine QPS, wrk
is usually the weapon of choice. And when it comes to writing complex test scenarios, k6
, with its powerful scripting capabilities and developer-friendly ecosystem, has become the go-to for many teams. Of course, there are plenty of other tools out there as well.
All of these tools are great, but technology doesn’t stand still. HTTP/3 has moved from being “the future” to “the present,” WebSocket use cases are becoming more common, and in today’s DevOps world, one-off, static performance reports are no longer enough. What we really need is real-time performance data that integrates seamlessly into our observability stack.
This naturally raises a question:
Is there a tool that’s as simple and straightforward as ab
, supports modern protocols like HTTP/3 and WebSocket, and integrates with monitoring systems like Prometheus just as easily as k6
?
The answer is yes. Let me introduce you to a rising star—perftest
.
What is PerfTest?
perftest
is a lightweight, high-performance load testing tool integrated into the Sponge Go framework. Think of it as a “special forces operator” designed for modern network protocols and cloud-native monitoring.
Its key highlights are:
- Protocol versatility: Native support for HTTP/1.1, HTTP/2, HTTP/3, and WebSocket.
-
Flexible modes: Run a fixed number of requests (
--total
) or apply load continuously for a given duration (--duration
). -
Seamless monitoring integration: Its killer feature.
perftest
can stream real-time metrics (QPS, latency, etc.) directly into Prometheus or any custom HTTP endpoint—your Grafana dashboards will light up instantly. - Simplicity: Everything is controlled through clean, minimal CLI parameters, making it incredibly easy to learn.
When should you use PerfTest?
There are a few scenarios where perftest
really shines:
Testing cutting-edge protocols
If your service supports HTTP/3 or gRPC-Web (built on HTTP/2+),perftest
helps you measure the performance benefits without extra hassle.Load testing real-time communication
Have a chat app, real-time trading platform, or collaborative editor using WebSockets?perftest
can simulate large client loads and high-frequency message storms to validate your backend capacity.Performance checks in CI/CD
Addperftest
as a step in your pipeline. After every merge, it can benchmark critical endpoints, push metrics to Prometheus, and trigger alerts when performance regresses.Quick and simple validation
Don’t want to write a fullk6
script just to test one API? Withperftest
, you can run a concurrency test in seconds and get a detailed report.
Getting Started
Since perftest
is built in Go, installation is as simple as:
go install github.com/go-dev-frame/sponge/cmd/sponge@latest
Once installed, you’re ready to run tests. Let’s look at some examples.
HTTP Load Testing Example
Benchmark an HTTP/1.1 endpoint with 50 workers and 1 million requests:
sponge perftest http \
--worker=50 \
--total=1000000 \
--url=http://localhost:8080/user/1
Run a continuous 1-minute test instead:
sponge perftest http \
--worker=50 \
--duration=1m \
--url=http://localhost:8080/user/1
Switching to HTTP/2 or HTTP/3? Just replace http
with http2
or http3
. Everything else stays the same.
Want live metrics in Prometheus? Add --prometheus-job-name
and --push-url
.
At the end, you’ll get a detailed report:
========== HTTP/1.1 Performance Test Report ==========
[Requests]
• Total Requests: 1000000
• Successful: 1000000 (100%)
• Failed: 0
• Total Duration: 8.55 s
• Throughput (QPS): 116914.5 req/sec
[Latency]
• Average: 0.42 ms
• Minimum: 0 ms
• Maximum: 22.41 ms
• P25: 0 ms
• P50: 0.51 ms
• P95: 1.18 ms
[Data Transfer]
• Sent: 25000000 Bytes
• Received: 49000000 Bytes
[Status Codes]
• 200: 1000000
[Push Statistics]
• ok
Prefer a UI instead of CLI? Just run:
sponge run
Then navigate to Public → Generate Performance Test Report, fill in parameters, and start testing.
Simulating a WebSocket Message Storm
Let’s simulate 100 users chatting simultaneously, each sending 2 messages per second (every 500ms) for 5 minutes:
sponge perftest websocket \
--worker=100 \
--duration=5m \
--send-interval=500ms \
--body={\"event\":\"message\",\"payload\":\"Hello, perftest!\"} \
--url=ws://localhost:8080/ws
At the end, you’ll see clear stats on connection success rates, messages sent/received, and throughput.
PerfTest vs. ab, wrk, k6
How does perftest
compare against the classics?
Feature / Tool | ab | wrk / wrk2 | k6 | perftest |
---|---|---|---|---|
Core focus | Simple validation | Extreme performance | Complex scenarios & developer UX | Modern protocols & monitoring |
HTTP/1.1 | ✅ | ✅ | ✅ | ✅ |
HTTP/2 | ❌ | ❌ (special branch) | ✅ | ✅ |
HTTP/3 (QUIC) | ❌ | ❌ | ❌ (community add-on) | ✅ (native) |
WebSocket | ❌ | ❌ (script needed) | ✅ | ✅ |
Real-time metrics | ❌ | ❌ | ✅ | ✅ (native) |
Scripting | None | Lua | JavaScript | None |
Ease of use | Very low | Medium | Medium | Very low |
Deep Dive
- ab (The Old Guard): Simple and reliable, but limited to HTTP/1.1.
- wrk (The Speedster): Blazing fast, great for raw throughput, but weak protocol support.
- k6 (The Powerhouse): Rich ecosystem, powerful scripting, widely adopted, but HTTP/3 support is still unofficial.
- perftest (The Specialist): Excels in two areas:
- Cutting-edge protocol support (HTTP/3, WebSocket).
- Native integration with Prometheus for effortless observability.
Conclusion
perftest
is a modern, focused load testing tool designed for today’s cloud-native world.
It’s perfect if you need to:
- Benchmark new protocols like HTTP/3 or WebSocket.
- Stream performance metrics directly into Prometheus and visualize them in Grafana.
- Add lightweight performance checks to your CI/CD pipeline.
- Use something stronger than
ab
but lighter thank6
.
In short, perftest
is like a sharp scalpel: precise, efficient, and built for modern performance testing. At a time when tools are getting bigger and heavier, this small but powerful utility might be exactly what you’ve been looking for.
Upcoming: Distributed cluster testing, with a central coordinator managing multiple nodes.
💡 About Sponge
Sponge is a powerful and easy-to-use Go framework. With the philosophy of “Definition is Code”, it makes it easy to build stable, reliable, high-performance backend services using a low-code approach. It supports RESTful API, gRPC, HTTP+gRPC, and gRPC Gateway.
Its built-in AI assistant can analyze your service code in context and generate business logic intelligently, significantly improving development efficiency.
👉 GitHub: https://github.com/go-dev-frame/sponge
Top comments (0)