Skip to content
polatouche6Public
forked from wg/wrk

About

Modern HTTP benchmarking tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

87 Commits

Folders and files

Repository files navigation

wrk - a HTTP benchmarking tool

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.

An optional LuaJIT script can perform HTTP request generation, response processing, and custom reporting. Details are available in SCRIPTING and several examples are located in scripts/.

wrk speaks HTTP/1.1 by default, plus opt-in HTTP/2 (--http2, --http2-prior-knowledge) and HTTP/3 (--http3) backends built on the bundled nghttp2 and ngtcp2/nghttp3 libraries.

Basic Usage

wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html

This runs a benchmark for 30 seconds, using 12 threads, and keeping 400 HTTP connections open.

Output:

Running 30s test @ http://127.0.0.1:8080/index.html
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   635.91us    0.89ms  12.92ms   93.69%
    Req/Sec    56.20k     8.07k   62.00k    86.54%
  22464657 requests in 30.00s, 17.76GB read
Requests/sec: 748868.53
Transfer/sec:    606.33MB

Command Line Options

-c, --connections: total number of HTTP connections to keep open with
                   each thread handling N = connections/threads

-d, --duration:    duration of the test, e.g. 2s, 2m, 2h

-t, --threads:     total number of threads to use

-s, --script:      LuaJIT script, see SCRIPTING

-H, --header:      HTTP header to add to request, e.g. "User-Agent: wrk"

-m, --streams:     HTTP/2 or HTTP/3 concurrent streams per connection
                   (closed-loop: a new request opens when one completes).
                   Requires --http2, --http2-prior-knowledge, or --http3.

    --latency:     print detailed latency statistics

    --latency-log: write one latency sample per request to
                   <prefix>-t<thread>-<seq>.log (`t<thread>_<seq>,<us>`
                   per line, rotated). Every request carries an
                   `X-Request-Id: t<thread>_<seq>` header so server logs
                   correlate 1:1 with wrk output; this flag only turns
                   the local log files on. Exception: HTTP/1.1 pipelined
                   requests (a script whose `request()` returns several
                   pipelined requests) are not tagged — one header line
                   cannot label N sub-requests — but each response still
                   gets its own log entry and id.

    --timeout:     record a timeout if a response is not received within
                   this amount of time.

    --http1.1:     use HTTP/1.1 (the default when no protocol flag is given)

    --http2:       use HTTP/2 over TLS (ALPN "h2")

    --http2-prior-knowledge:
                   use HTTP/2 in cleartext, sending the client preface
                   without negotiation

    --http3:       use HTTP/3 (QUIC) over TLS; defaults to port 443 when
                   the URL has no port. Requires OpenSSL >= 3.5 at build
                   time; `wrk -v` shows `-h3` when compiled out.

-v, --version:     print version and compiled-in protocol backends

Protocol selection matrix

flag                    http://         https://
----------------------  --------------  --------------
(none)                  HTTP/1.1        HTTP/1.1 + TLS
--http2                 rejected        HTTP/2
--http2-prior-knowledge HTTP/2 cleartext rejected
--http3                 rejected        HTTP/3

In h2/h3 modes request() must yield exactly one HTTP request; use -m/--streams for concurrency instead of pipelining. h2/h3 map an explicit Host: header (or the URL, including a non-default port or an IPv6 literal) to :authority.

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. Per-request actions, particularly building a new HTTP request, and use of response() will necessarily reduce the amount of load that can be generated.

Acknowledgements

wrk contains code from a number of open source projects including the 'ae' event loop from redis, the nginx/joyent/node.js 'http-parser', and Mike Pall's LuaJIT. Please consult the NOTICE file for licensing details.

Cryptography Notice

This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See http://www.wassenaar.org/ for more information.

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with symmetric algorithms. The form and manner of this distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

About

Modern HTTP benchmarking tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages