[vegeta] 부하 테스트
2023. 11. 14. 15:02
vegeta를 사용해 api 부하 테스트를 진행하려 한다.
vegeta 설치 (Mac OS)
brew update && brew install vegeta
vegeta 스크립트 작성
'@payload.json'은 POST 요청에 사용할 JSON payload를 담고 있는 파일 경로
해당 파일을 작성하고 적절한 JSON 데이터를 추가해야 함
# attack-rate-script.txt
POST http://host:port/api-name/
Content-Type: application/json
@payload.json
json payload.json 작성
# payload.json 예시
{
"key1": "value1",
"key2": "value2",
...
}
vegeta 실행
아래 예시는 duration 60초 동안 1초에 요청 5개씩 (rate=5) 보내는 것이다
vegeta attack -targets=attack-rate-script.txt -duration=60s -rate=5 --output results.bin; vegeta report results.bin
이후 아래 명령어로 plot을 볼 수 있다.
cat results.bin| vegeta plot > plot.results.html
json으로 결과를 볼 수도 있다.
vegeta attack -targets=attack-rate-script.txt -duration=60s -rate=5 | vegeta report -type=json > result.json
https://github.com/tsenart/vegeta
GitHub - tsenart/vegeta: HTTP load testing tool and library. It's over 9000!
HTTP load testing tool and library. It's over 9000! - GitHub - tsenart/vegeta: HTTP load testing tool and library. It's over 9000!
github.com
'업무 > 메모' 카테고리의 다른 글
ssh 키 설정 + alias로 계정만으로 ssh 접속하기 (0) | 2025.02.20 |
---|---|
[Gunicorn]max_requests와 max_requests_jitter (0) | 2023.11.09 |
[개발환경 구성] 모놀로식 아키텍처 (0) | 2023.07.04 |
[mathplotlib] 한글 깨짐 (0) | 2023.06.12 |
[Python] 이모지 제거 (0) | 2023.02.08 |