CentOS8.3に負荷テストツールWrkをインストールする方法

# cat /etc/redhat-release
CentOS Linux release 8.3.2011

ダウンロード
# git clone https://github.com/wg/wrk.git
Cloning into 'wrk’…
remote: Enumerating objects: 1103, done.
remote: Total 1103 (delta 0), reused 0 (delta 0), pack-reused 1103
Receiving objects: 100% (1103/1103), 37.84 MiB | 9.33 MiB/s, done.
Resolving deltas: 100% (343/343), done.

# cd wrk
# make

LUAJIT src/wrk.lua
cc -std=c99 -Wall -O2 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iobj/include -Iobj/include/luajit-2.1 -c -o obj/bytecode.o obj/bytecode.c
LINK wrk

wrkを「/usr/local/bin/」にコピー

# sudo cp wrk /usr/local/bin/

バージョンを確認
# wrk –version

wrk 4.1.0-8-ga211dd5 [epoll] Copyright (C) 2012 Will Glozer
Usage: wrk <options> <url>
  Options:
    -c, --connections <N>  Connections to keep open
    -d, --duration    <T>  Duration of test
    -t, --threads     <N>  Number of threads to use

    -s, --script      <S>  Load Lua script file
    -H, --header      <H>  Add header to request
        --latency          Print latency statistics
        --timeout     <T>  Socket/request timeout
    -v, --version          Print version details

  Numeric arguments may include a SI unit (1k, 1M, 1G)
  Time arguments may include a time unit (2s, 2m, 2h)

使い方
書式
wrk -tスレッド数 -cコネクション数 -d秒数 http://テスト用URL
# wrk -t20 -c150 -d20s http://テスト用URL

Running 20s test @ http://テスト用URL
  20 threads and 150 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    30.68ms   57.13ms   1.60s    96.39%
    Req/Sec   212.72    154.47   524.00     48.72%

 

CentOS

Posted by arkgame