What is wrk2?

Wrk2 is an invaluable tool for developers and performance enthusiasts alike. It provides a robust framework for load testing and benchmarking web servers, allowing you to simulate real-world traffic scenarios with precision and ease.

wrk2 is a constant throughput, correct latency recording variant of wrk.

wrk2 (as is wrk) is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue.

wrk2 is wrk modifed to produce a constant throughput load, and accurate latency details to the high 9s (i.e. can produce accurate 99.9999%'ile when run long enough). In addition to wrk's arguments, wrk2 takes a throughput argument (in total requests per second) via either the --rate or -R parameters (default is 1000).

How to use wrk2?

Example command - wrk -t2 -c100 -d30s -R2000

This runs a benchmark for 30 seconds, using 2 threads, keeping 100 HTTP connections open, and a constant throughput of 2000 requests per second (total, across all connections combined).

[It's important to note that wrk2 extends the initial calibration period to 10 seconds (from wrk's 0.5 second), so runs shorter than 10-20 seconds may not present useful information]

wrk2 will usually be run with the --latency flag, which provides detailed latency percentile information (in a format that can be easily imported to spreadsheets or gnuplot scripts and plotted.

Example command - wrk -t2 -c100 -d30s -R2000 --latency

Benchmarking Tips:

  • The machine running wrk must have a sufficient number of ephemeral ports available and closed sockets should be recycled quickly.
  • To handle the initial connection burst the server's listen(2) backlog should be greater than the number of concurrent connections being tested.
  • A user script that only changes the HTTP method, path, adds headers or a body, will have no performance impact.
  • If multiple HTTP requests are necessary they should be pre-generated and returned via a quick lookup in the request() call.
  • Per-request actions, particularly building a new HTTP request, and use of response() will necessarily reduce the amount of load that can be generated.

What sets Wrk2 apart is its efficiency and accuracy in measuring performance metrics, enabling you to identify bottlenecks and optimize your applications effectively.

Whether you're fine-tuning your server configurations or evaluating the scalability of your system, Wrk2 empowers you to make informed decisions that drive performance improvements.

More tools in Performance Testing

Siege logo


HTTP load tester and benchmarking utility

Performance Testing
Apache Bench logo

Apache Bench

Apache HTTP server benchmarking tool.

Performance Testing


A flaky network simulator for your mobile app

Performance Testing