ETC

부하테스트 툴 (locust) _ docker-compose

Dragonfog.net 2022. 12. 13. 11:41
반응형

참고 : https://locust.io/

 

Locust.io

An open source load testing tool. Define user behaviour with Python code, and swarm your system with millions of simultaneous users.

locust.io

 

부하테스트 툴인 locust 구성 방법

 

 

## 디렉토리 내 2개 파일 필요
locust
├── docker-compose.yml ### docker-compose 파일
└── locustfile.py      ### locust task 정의 파일

 

## docker-compose file
version: '3'
services:
  master:
    image: locustio/locust
    ports:
     - "8089:8089"
    volumes:
      - ./:/mnt/locust
    command: -f /mnt/locust/locustfile.py --master -H http://master:8089
  worker:
    image: locustio/locust
    volumes:
      - ./:/mnt/locust
    command: -f /mnt/locust/locustfile.py --worker --master-host master


## locustfile.py Sample

import time
from locust import HttpUser, task, between

 


class QuickstartUser(HttpUser):
    wait_time = between(1, 2)

 

   @task
    def hello_world(self):
        self.client.get("/hello")
        self.client.get("/world")


실행 방법
## 실행
docker-compose up -d  --scale worker=4
 
## 중지
docker-compose down

반응형

'ETC' 카테고리의 다른 글

런타임 데드 코드 분석 도구 Scavenger  (0) 2023.09.12
URL 정리  (0) 2023.01.17
Intermax License 업데이트 하기  (0) 2022.03.04
NKEY BT61 페어링 방법  (0) 2021.08.06
한장으로 보는 정규 표현식  (0) 2021.07.30