Skip to main content

Wrk/Wrk2 HTTP Benchmarking

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 to produce high request throughput with low resource consumption.

Wrk2 is a variant of wrk that adds constant-throughput, correct-latency recording using a modified version of Gil Tene's wrk2 rate-limiting approach. Unlike wrk (which measures only coordinated-omission-free throughput), wrk2 takes a target request rate and produces an HdrHistogram-corrected latency distribution, making it suitable for latency-sensitive benchmarks.

In Virtual Client, wrk and wrk2 serve as the HTTP client load generators for Nginx and ASP.NET web server workloads. They run on a dedicated client machine and send requests to a server machine running the target web server.

Deployment Modes

The Wrk/Wrk2 executors support two deployment modes when used with ASP.NET server workloads:

  • Multi-VM (Client-Server) — The client and server run on separate machines connected via a layout file. This isolates load generation from server processing for accurate benchmarking.
  • Single-VM — When no layout file is provided, wrk connects to the server via the loopback address (127.0.0.1). Both server and client actions run sequentially on the same machine.

Note: Nginx workloads (PERF-WEB-NGINX-*.json) require a multi-VM layout and do not support single-VM mode.

What is Being Measured?

The Wrk/Wrk2 toolset generates sustained HTTP/HTTPS request traffic against a target web server and captures the following:

  • Latency percentile distribution — full HdrHistogram percentiles (P50 through P100) of response latency. Values are normalized to milliseconds.
  • Requests per second — the aggregate throughput achieved during the test run.
  • Transfer rate — the data transfer rate achieved during the test run (megabytes/sec).

Wrk2 additionally captures an uncorrected latency distribution that records raw measured latency without accounting for coordinated omission. Both tools optionally emit a detailed percentile spectrum for fine-grained latency analysis (controlled by the EmitLatencySpectrum parameter).

Workload Metrics

The following metrics are examples of those captured by the Virtual Client when running the Wrk workload. Latency values are normalized to milliseconds by the parser regardless of the unit reported by wrk (nanoseconds, microseconds, milliseconds, or seconds).

Latency Distribution Metrics

Tool NameMetric NameExample ValueUnit
Wrklatency_p501.427milliseconds
Wrklatency_p751.982milliseconds
Wrklatency_p902.683milliseconds
Wrklatency_p993.960milliseconds
Wrklatency_p99_96.930milliseconds
Wrklatency_p99_998.990milliseconds
Wrklatency_p99_9999.770milliseconds
Wrklatency_p1009.770milliseconds

When wrk2 is used, an additional set of uncorrected latency metrics is emitted:

Tool NameMetric NameExample ValueUnit
Wrk2uncorrected_latency_p500.483milliseconds
Wrk2uncorrected_latency_p751.120milliseconds
Wrk2uncorrected_latency_p901.710milliseconds
Wrk2uncorrected_latency_p992.870milliseconds
Wrk2uncorrected_latency_p99_95.760milliseconds
Wrk2uncorrected_latency_p99_998.020milliseconds
Wrk2uncorrected_latency_p99_9998.410milliseconds
Wrk2uncorrected_latency_p1008.410milliseconds

Throughput Metrics

Tool NameMetric NameExample ValueUnit
Wrkrequests/sec16305.17requests/sec
Wrktransfers/sec20.01megabytes/sec

Latency Spectrum Metrics (Optional)

When the EmitLatencySpectrum parameter is set to true, the parser emits fine-grained percentile spectrum data points. These are useful for visualizing full HdrHistogram latency distributions.

Tool NameMetric NameExample ValueUnitDescription
Wrklatency_spectrum_p0_0000000.175TotalCount:1
Wrklatency_spectrum_p0_1000000.566TotalCount:3954
Wrklatency_spectrum_p0_5000001.427TotalCount:19773
Wrklatency_spectrum_p0_9000002.683TotalCount:35553
Wrklatency_spectrum_p0_9900003.960TotalCount:39130
Wrklatency_spectrum_p0_9990007.011TotalCount:39462
Wrklatency_spectrum_p1_0000009.767TotalCount:39500

Error Metrics

Tool NameMetric NameExample ValueUnit
WrkNon-2xx or 3xx responses58902

If socket errors are detected, the parser raises a WorkloadException with a Socket Error metric.

Profiles

The following profiles are available for the Wrk/Wrk2 workloads.

Profile NameDescriptionClient ToolServerPlatforms
PERF-WEB-NGINX-WRK.jsonNginx web server benchmark using wrk. Tests 100 to 10K connections at multiple thread counts.WrkExecutorNginxServerExecutorlinux-x64, linux-arm64
PERF-WEB-NGINX-WRK2.jsonNginx web server benchmark using wrk2 with constant request rate and corrected latency.Wrk2ExecutorNginxServerExecutorlinux-x64
PERF-WEB-NGINX-WRK-RP.jsonNginx reverse-proxy benchmark using wrk. Uses a three-node layout (Client → Reverse Proxy → Server).WrkExecutorNginxServerExecutor (×2)linux-x64, linux-arm64
PERF-WEB-NGINX-WRK2-RP.jsonNginx reverse-proxy benchmark using wrk2. Uses a three-node layout (Client → Reverse Proxy → Server).Wrk2ExecutorNginxServerExecutor (×2)linux-x64
PERF-WEB-ASPNET-WRK.jsonASP.NET TechEmpower JSON serialization benchmark using wrk.WrkExecutorAspNetServerExecutorlinux-x64, linux-arm64, win-x64, win-arm64
PERF-WEB-ASPNET-WRK-AFFINITY.jsonASP.NET TechEmpower JSON serialization benchmark using wrk with CPU core affinity.WrkExecutorAspNetServerExecutorlinux-x64, linux-arm64, win-x64, win-arm64
PERF-WEB-ASPNET-ORCHARD-WRK.jsonASP.NET OrchardCore CMS benchmark using wrk.WrkExecutorAspNetOrchardServerExecutorlinux-x64, linux-arm64

Parameters

The following table describes the key parameters supported by the Wrk/Wrk2 executors.

ParameterDescriptionDefault
PackageNameThe name of the wrk or wrk2 dependency package.required
CommandArgumentsThe wrk/wrk2 command-line arguments (threads, connections, duration, URL, etc.).required
TargetServiceThe target service type: server, rp (reverse-proxy), or apigw (API gateway).auto-detected
TestDurationDuration of the test run (e.g., 00:02:30).profile-defined
TimeoutMaximum time to wait for server availability.5 minutes
WarmUpWhen true, the run is a warm-up pass and metrics are not captured.false
EmitLatencySpectrumWhen true, the fine-grained latency spectrum is emitted as additional metrics.false
BindToCoresWhen true, the wrk process is pinned to specific CPU cores.false
CoreAffinityCPU core affinity specification (e.g., 0-3, 0,2,4,6). Required when BindToCores is true.none

Wrk Command Line Options

The following are the key command-line options for wrk and wrk2. These are referenced in the CommandArguments parameter in Virtual Client profiles.

OptionDescription
-t, --threadsTotal number of threads to use.
-c, --connectionsTotal number of HTTP connections to keep open (each thread handles N = connections/threads).
-d, --durationDuration of the test (e.g., 2s, 2m, 2h).
-R, --rateTotal requests per second (wrk2 only). Enables constant-throughput, corrected-latency recording.
-L, --latencyPrint detailed latency statistics (HdrHistogram percentile distribution).
--timeoutRecord a timeout if a response is not received within this amount of time.

Translating a Profile to a Command

Virtual Client profiles define wrk parameters declaratively. The executor translates them into a wrk command line at runtime. For example, the following profile action:

{
"Type": "WrkExecutor",
"Parameters": {
"PackageName": "wrk",
"Scenario": "benchmark_measurement",
"CommandArguments": "--latency --threads {ThreadCount} --connections {Connection} --duration {TestDuration.TotalSeconds}s --timeout 10s http://{serverip}:{ServerPort}/json",
"ThreadCount": "64",
"Connection": 4096,
"TestDuration": "00:00:15",
"ServerPort": 9876,
"Role": "Client"
}
}

Translates to the following wrk command (assuming server IP 10.0.0.5):

wrk --latency --threads 64 --connections 4096 --duration 15s --timeout 10s http://10.0.0.5:9876/json

Performance Notes

Generally, the more concurrent connections you configure, the higher the load on the server. At some point, increasing connections further will result in diminishing returns in requests per second and increased latency, as the server becomes saturated. This saturation point is useful for characterizing the maximum throughput capacity of the server under test.