Simple test tool wrk

Time:2019-11-8

Reprint please indicate the source http://www.parallel.com
Original typesetting address Click to jump

introduce

Wrk is a very simple HTTP performance testing tool. It can also be called HTTP benchmark tool. With only one command line, you can do many basic HTTP performance tests

Simple steps

install

git clone https://github.com/wg/wrk.git  
cd wrk  
make  

Use

wrk -t12 -c100 -d30s -T30 http://www.baidu.com 
wrk -t2 -c100 -d30s http://localhost:8081/ticket/tyj/profitList/uegjVvnL-Watj-iFBA-X4lu-OHINAkqC7Cwy
  • T: thread count
  • C: number of requested connections
  • D: test time,
  • T: the default timeout is 1 second. This is a little short. I usually set it to 30 seconds

In general, the number of threads should not be too many. Two to four times the number of cores is enough. If there are too many threads, the efficiency will be reduced. Because wrk does not use the model of one thread per connection, but uses asynchronous network IO to increase the concurrency. Therefore, network communication will not block the execution of threads. This is also the reason why wrk can simulate a large number of network connections with a few threads. Now, there are many Performance tools do not use this method, but use to increase the number of threads to achieve high concurrency. So once the concurrency is set to a high level, the test machine itself will be under a lot of pressure, and the test effect will decline

The result shows

  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   354.59ms  377.09ms   1.99s    83.74%
    Req/Sec    21.07     12.79    90.00     80.37%
  6957 requests in 30.10s, 102.55MB read
  Socket errors: connect 0, read 19, write 0, timeout 117
Requests/sec:    231.11
Transfer/sec:      3.41MB
  • Latency: it can be understood as response time, with average value, standard deviation, maximum value and proportion of plus or minus one standard deviation
  • Req / sec: the number of requests completed by each thread per second, with the same average value, standard deviation, maximum value, and the proportion of plus or minus one standard deviation
  • Generally speaking, we mainly focus on the average value and the maximum value. If the standard deviation is too large, it means that the sample itself has a high degree of dispersionSystem performance fluctuates greatly.

Advanced – script call

post.lua
wrk.method = "POST"  
wrk.body   = "foo=bar&baz=quux"  
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"  
call
wrk -t12 -c100 -d30s -T30s --script=post.lua --latency http://www.baidu.com  

Reference website

Wrk — a small and lightweight HTTP performance testing tool

Recommended Today

The use of progressbarcontrol, a progress bar control of devexpress – Taking ZedGraph as an example to add curve progress

scene WinForm control – devexpress18 download installation registration and use in vs: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100061243 When using ZedGraph to add curves, the number of curves is slower if there are many cases. So in the process of adding curve, the progress needs to be displayed, and the effect is as follows     Note: Blog home page:https://blog.csdn.net/badao_liumang_qizhi […]