How to Quickly Benchmark Your API with Benchttp: A Lightweight Go Tool
Benchttp is a minimal‑weight Go‑based load‑testing utility that lets you measure QPS, duration, and concurrency with simple command‑line flags, and the article explains its usage, common parameters, and step‑by‑step installation on Linux.
If you care mainly about QPS (queries per second), Benchttp is ideal.
Benchttp is an ultra‑lightweight load‑testing tool, easy to install and its usage resembles Apache's ab, producing concise results.
Example
Send 100 requests with a concurrency of 20: benchttp -n 100 -c 20 http://localhost:8080 The result shows:
Requests: 100 (1.6/s) – the “1.6/s” indicates the number of requests processed per second.
Duration: 62.391s – total time to finish all requests; the value equals 100 / 1.6.
Common Parameters
-n– total number of requests. -c – maximum concurrent requests. -d – test duration in seconds. -H – custom header, e.g., “key: value”.
Installation
Install via Go: go get -u github.com/siadat/benchttp If Go is not installed, set it up first (e.g., on CentOS): yum install go Then configure GOPATH: export GOPATH=/root/go Reload the profile: source /etc/profile After installation, the Benchttp directory appears under $GOPATH.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
