Performance testing and benchmarking tools

Written on February 15, 2022

In this post I want to show you 3 different load testing solutions for your performance benchmarks/tests. From simple to advanced.

1. Wrk

Simple “point and shoot” solution. My go-to solution for quick load test of GET requests to single URL. For multiple URLs one can use Lua scripts. Results are helpful, although sometimes you want more details.

wrk options

Example of wrk benchmark:

wrk -d 10 -c 200  --latency --timeout 5s "http://localhost:8081/hello?name=world"

In results, you can see requests/sec, latency distribution etc.

wrk results

2. Vegeta

Written in go, so you can just download the binary from GitHub. More capable than wrk, need some time to dive in. Following the UNIX spirit, vegeta consists of several commands with you can combine to get different results.

vegeta options

You can generate “targets” from any source - file, curl or script output. Reporting capabilities are also broader, from simple text results

print "GET http://localhost:8081/hello?name=world" | vegeta attack -duration=10s -rate=5000/1s | tee results.bin | vegeta report

vegeta report to hdr plots

print "GET http://localhost:8081/hello?name=world" | vegeta attack -duration=10s -rate=5000/1s | tee results.bin | vegeta plot > plot.5000qps.html

vegeta plot Vegeta supports different types of requests, as well as http2 protocol. Also, you can use Vegeta programmatically with Go API.

vegeta api

3. Gatling

Its a tool which you can use in self-hosted or cloud environment. It has Java/Scala/Kotlin API to write advanced scenarios using DSL. You can re-use parts of your benchmarks as code. You can map this scenario gatling scenario to this benchmark as code snippet gatling code

Results output are beautiful yet informative html charts that you can browse and share. The learning curve is higher, but this instrument gives you more capabilities. gatling results gatling percentiles

For different cases you might need different tools. Which one suits your use cases? Let’s discuss on twitter.


Tags: scala, java, kotlin, go, benchmarking, performance-testing