1
0
mirror of https://github.com/wg/wrk synced 2025-01-23 20:23:03 +08:00
Go to file
2013-08-18 13:38:06 +09:00
deps/luajit import LuaJIT 2.0.2 2013-08-17 13:26:40 +09:00
scripts generate requests with lua script 2013-08-18 13:38:06 +09:00
src generate requests with lua script 2013-08-18 13:38:06 +09:00
.gitignore generate requests with lua script 2013-08-18 13:38:06 +09:00
LICENSE first public release of wrk 2012-03-18 15:39:52 +09:00
Makefile generate requests with lua script 2013-08-18 13:38:06 +09:00
NOTICE generate requests with lua script 2013-08-18 13:38:06 +09:00
README generate requests with lua script 2013-08-18 13:38:06 +09:00

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.

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

Scripting

  The "scripted" branch of wrk includes LuaJIT and a Lua script may be
  used to perform minor alterations to the default HTTP request or even
  even generate a completely new HTTP request each time. Per-request
  actions, particularly building a new HTTP request, will necessarily
  reduce the amount of load that can be generated.

  wrk's public Lua API is:

    init    = function()
    request = function()

    wrk = {
      scheme  = "http",
      host    = "localhost",
      port    = nil,
      method  = "GET",
      path    = "/",
      headers = {},
      body    = nil
    }

    function wrk.format(method, path, headers, body)

      wrk.format returns a HTTP request string containing the passed
      parameters merged with values from the wrk table.

    global init    - function to be called when the thread is initialized
    global request - function returning the HTTP message for each request

  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 generated in the call to init() and returned
  via a quick lookup in the request() call.

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.

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',
  Mike Pall's LuaJIT, and the Tiny Mersenne Twister PRNG. Please consult
  the NOTICE file for licensing details.