somoly.tistory.com
Published 2023. 6. 5. 15:43
wrk - a HTTP benchmarking tool Linux

소개

  • wrk는 단일 멀티코어 CPU에서 실행할 때 상당한 부하를 발생시킬 수 있는 최신 HTTP 벤치마킹 도구입니다. 
  • 멀티스레드 설계와 확장 가능한 이벤트 알림 시스템(예: epoll 및 kqueue)이 결합되어 있습니다.
  • 선택 사항인 LuaJIT 스크립트는 HTTP 요청 생성, 응답 처리 및 사용자 지정 보고를 수행할 수 있습니다. 
  • 자세한 내용은 스크립팅에서 확인할 수 있으며 몇 가지 예제는 `scripts/` 에 있습니다.
  • https://github.com/wg/wrk
 

GitHub - wg/wrk: Modern HTTP benchmarking tool

Modern HTTP benchmarking tool. Contribute to wg/wrk development by creating an account on GitHub.

github.com

기본 사용법

# 30초 동안 12 쓰레드, 400 커넥션으로 벤치마킹 실행
wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html

# lua 스크립트를 이용한 실행
wrk -s my-script.lua http://127.0.0.1:8080/index.html

# 실행 결과
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

 

커맨드라인 옵션

-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"

    --latency:     print detailed latency statistics

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

somoly.tistory.com

@RxCats

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!