explaingit

giltene/wrk2

4,587CAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line HTTP load tester that sends requests at a fixed, controlled rate so your latency numbers reflect what real users experience, not the artificially optimistic results that most load generators produce.

Mindmap

mindmap
  root((wrk2))
    What it does
      Fixed rate load testing
      Avoids Coordinated Omission
      Accurate latency reporting
    Tech stack
      C single binary
      OpenSSL
      Lua scripting
    Outputs
      HdrHistogram percentiles
      p99 p99.9 p99.9999
    Use cases
      HTTP benchmarking
      Server capacity planning
      Pre-deploy stress testing
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run a fixed-rate load test against an HTTP API to measure true 99th-percentile latency without coordinated omission bias.

USE CASE 2

Benchmark a web server to find out how it holds up under sustained, constant traffic rather than a burst.

USE CASE 3

Use the Lua scripting interface to generate custom HTTP requests with dynamic headers or bodies during a load test.

Tech stack

CMakeOpenSSLLuaHdrHistogram

Getting it running

Difficulty · easy Time to first run · 5min

Requires Make and OpenSSL to build from source, produces a single binary with no runtime dependencies after compilation.

No license information is stated in the explanation.

In plain English

wrk2 is a command-line tool for load testing HTTP servers. You point it at a URL, tell it how many requests per second to send, and it runs the test for however long you specify, then reports back how the server performed. It is built on top of wrk, an existing benchmarking tool, with a key difference: wrk2 sends requests at a constant, controlled rate rather than sending them as fast as possible. That distinction matters because of a problem the author calls Coordinated Omission. When a load generator simply blasts requests as fast as it can, it naturally slows down when the server gets backed up, so the slowest responses are underrepresented in the results. The numbers look better than reality. wrk2 sends requests on a fixed schedule regardless of how slowly the server is responding, which means the reported latency includes the time requests spend waiting to be handled, not just the time spent in flight. This gives a more accurate picture of what real users would experience. Latency results are stored using a data structure called an HdrHistogram, which records every value without losing precision at high percentiles. This allows wrk2 to accurately report what happened at the 99th, 99.9th, or even 99.9999th percentile if you run the test long enough. Usage looks like this: you specify the number of threads, the number of open connections, the duration of the test, and the target request rate. An optional Lua scripting interface, inherited from wrk, lets you customize how requests are generated and how results are processed. Several example scripts are included in the repository. The tool is written in C and runs on Linux and macOS. Building it requires Make and OpenSSL. It is single-binary and has no runtime dependencies beyond the operating system. The README includes detailed output examples and a lengthy explanation of Coordinated Omission for readers who want to understand why conventional load generators produce misleading latency numbers. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
I want to run wrk2 against my API at exactly 1000 requests per second for 60 seconds using 4 threads and 100 connections. Give me the exact command.
Prompt 2
Write a Lua script for wrk2 that sends POST requests with a JSON body to /api/submit, including an Authorization header.
Prompt 3
I ran wrk2 and got p99 latency of 200ms but p99.9 of 2 seconds. Help me interpret what this means for real users and whether I should be worried.
Prompt 4
My team uses wrk rather than wrk2, explain the key difference and help me decide whether to switch to wrk2 for our next benchmark.
Prompt 5
How do I build wrk2 from source on Ubuntu? What packages do I need and what commands do I run?
Open on GitHub → Explain another repo

← giltene on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.