Skip to content

Latest commit

 

History

History
135 lines (119 loc) · 5.32 KB

wrk.md

File metadata and controls

135 lines (119 loc) · 5.32 KB

wrk

https://github.com/wg/wrk

wrk는 HTTP 벤치마크 툴이다.

$ wrk -t7 -c100 -d10s https://google.com
Running 10s test @ https://google.com
  7 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    77.10ms    7.98ms 251.74ms   92.75%
    Req/Sec   181.05     23.21   240.00     82.83%
  12542 requests in 10.08s, 8.77MB read
Requests/sec:   1243.90
Transfer/sec:      0.87MB

위 명령어를 입력하면 쓰레드 7개, 최대 100개의 동시 연결로 10초동안 구글에 요청을 마구 보낸다.

wrk2

https://github.com/giltene/wrk2

wrk의 latency 측정 방식에 문제가 좀 있는지 누군가가 개선하여 wrk2라는 것도 내놓았다.

$ wrk2 -R1000 -t7 -c100 -d10s https://google.com
Running 10s test @ https://google.com
  7 threads and 100 connections
  Thread calibration: mean lat.: 4156.029ms, rate sampling interval: 14344ms
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.10s     2.09s    7.97s    57.80%
    Req/Sec       -nan      -nan   0.00      0.00%
  2135 requests in 10.07s, 1.92MB read
Requests/sec:    211.99
Transfer/sec:    195.02KB

위 명령어를 입력하면 쓰레드 7개, 최대 100개의 동시 연결로 초당 1000개의 요청을 10초 동안 구글에 날린다.

-L 또는 --latency 옵션을 주면 더 자세한 레이턴시 결과를 얻을 수 있다.

$ wrk2 -R1000 -t7 -c100 -d10s -L https://google.com
Running 10s test @ https://google.com
  7 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.96s     2.07s    7.96s    58.14%
    Req/Sec       -nan      -nan   0.00      0.00%
  Latency Distribution (HdrHistogram - Recorded Latency)
 50.000%    3.95s 
 75.000%    5.72s 
 90.000%    6.79s 
 99.000%    7.73s 
 99.900%    7.93s 
 99.990%    7.97s 
 99.999%    7.97s 
100.000%    7.97s 

  Detailed Percentile spectrum:
       Value   Percentile   TotalCount 1/(1-Percentile)

     391.679     0.000000            1         1.00
    1116.159     0.100000          212         1.11
    1807.359     0.200000          422         1.25
    2545.663     0.300000          633         1.43
    3235.839     0.400000          843         1.67
    3946.495     0.500000         1054         2.00
    4304.895     0.550000         1160         2.22
    4661.247     0.600000         1266         2.50
    5005.311     0.650000         1371         2.86
    5349.375     0.700000         1475         3.33
    5718.015     0.750000         1581         4.00
    5881.855     0.775000         1633         4.44
    6086.655     0.800000         1688         5.00
    6254.591     0.825000         1740         5.71
    6426.623     0.850000         1791         6.67
    6619.135     0.875000         1844         8.00
    6713.343     0.887500         1870         8.89
    6787.071     0.900000         1897        10.00
    6868.991     0.912500         1925        11.43
    6983.679     0.925000         1950        13.33
    7090.175     0.937500         1977        16.00
    7135.231     0.943750         1989        17.78
    7221.247     0.950000         2002        20.00
    7315.455     0.956250         2015        22.86
    7364.607     0.962500         2028        26.67
    7458.815     0.968750         2042        32.00
    7512.063     0.971875         2049        35.56
    7536.639     0.975000         2055        40.00
    7557.119     0.978125         2061        45.71
    7618.559     0.981250         2068        53.33
    7679.999     0.984375         2076        64.00
    7684.095     0.985938         2078        71.11
    7696.383     0.987500         2081        80.00
    7704.575     0.989062         2085        91.43
    7757.823     0.990625         2088       106.67
    7766.015     0.992188         2091       128.00
    7774.207     0.992969         2094       142.22
    7774.207     0.993750         2094       160.00
    7794.687     0.994531         2097       182.86
    7802.879     0.995313         2098       213.33
    7811.071     0.996094         2099       256.00
    7823.359     0.996484         2100       284.44
    7860.223     0.996875         2101       320.00
    7876.607     0.997266         2102       365.71
    7880.703     0.997656         2103       426.67
    7880.703     0.998047         2103       512.00
    7909.375     0.998242         2104       568.89
    7909.375     0.998437         2104       640.00
    7933.951     0.998633         2105       731.43
    7933.951     0.998828         2105       853.33
    7933.951     0.999023         2105      1024.00
    7946.239     0.999121         2106      1137.78
    7946.239     0.999219         2106      1280.00
    7946.239     0.999316         2106      1462.86
    7946.239     0.999414         2106      1706.67
    7946.239     0.999512         2106      2048.00
    7966.719     0.999561         2107      2275.56
    7966.719     1.000000         2107          inf
#[Mean    =     3963.857, StdDeviation   =     2066.100]
#[Max     =     7962.624, Total count    =         2107]
#[Buckets =           27, SubBuckets     =         2048]
----------------------------------------------------------
  2114 requests in 10.02s, 1.90MB read
Requests/sec:    210.93
Transfer/sec:    194.04KB

위 데이터를 http://hdrhistogram.org/ 에 업로드하면 레이턴시 분포를 그려준다.