Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylertreat/bench
A generic latency benchmarking library.
https://github.com/tylertreat/bench
benchmark hdrhistogram latency latency-distribution
Last synced: 3 days ago
JSON representation
A generic latency benchmarking library.
- Host: GitHub
- URL: https://github.com/tylertreat/bench
- Owner: tylertreat
- License: apache-2.0
- Created: 2015-12-20T08:18:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T23:37:26.000Z (over 7 years ago)
- Last Synced: 2024-12-26T09:17:50.931Z (10 days ago)
- Topics: benchmark, hdrhistogram, latency, latency-distribution
- Language: Go
- Homepage:
- Size: 141 KB
- Stars: 313
- Watchers: 14
- Forks: 26
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bench [![GoDoc](https://godoc.org/github.com/tylertreat/bench?status.svg)](https://godoc.org/github.com/tylertreat/bench)
Bench is a generic latency benchmarking library. It's generic in the sense that it exposes a simple interface (`Requester`) which can be implemented for various systems under test. Several [example Requesters](https://github.com/tylertreat/bench/tree/master/requester) are provided out of the box.
Bench works by attempting to issue a fixed rate of requests per second and measuring the latency of each request issued synchronously. Latencies are captured using [HDR Histogram](https://github.com/codahale/hdrhistogram), which observes the complete latency distribution and attempts to correct for [Coordinated Omission](https://groups.google.com/forum/#!msg/mechanical-sympathy/icNZJejUHfE/BfDekfBEs_sJ). It provides facilities to generate output which can be [plotted](http://hdrhistogram.github.io/HdrHistogram/plotFiles.html) to produce graphs like the following:
![Latency Distribution](distribution.png)
## Example Benchmark
```go
package mainimport (
"fmt"
"time""github.com/tylertreat/bench"
"github.com/tylertreat/bench/requester"
)func main() {
r := &requester.RedisPubSubRequesterFactory{
URL: ":6379",
PayloadSize: 500,
Channel: "benchmark",
}benchmark := bench.NewBenchmark(r, 10000, 1, 30*time.Second, 0)
summary, err := benchmark.Run()
if err != nil {
panic(err)
}fmt.Println(summary)
summary.GenerateLatencyDistribution(nil, "redis.txt")
}
```