[Locust] 1. Locust 부하 테스트 툴(load testing tool)

2023. 3. 15. 00:06·Python/Open Source
반응형

Locust란?

  • https://locust.io/
  • https://docs.locust.io/en/stable/
  • Locust는 오픈 소스로 제공하는 부하 테스트 툴 프레임워크.
  • 매우 간단한 소스코드를 통해 기능을 수행할 수 있고 제공해주는 설정들을 통해서 유저 수량 지정 테스트 등 다양한 테스트를 진행 할 수 있음.
  • 간단한 개발과 설정으로 빠르게 테스트를 할 수 있는 환경을 갖출 수 있음.

설치

pip install locust

 

실행

locust.conf

locustfile = locust_impl.py
expect-workers = 5
host = http://localhost:8000
users = 10
spawn-rate = 10
run-time = 1m

locust_impl.py

from locust import task, FastHttpUser

class TargetURL:
    ROOT = "/"
    STRING = "/string"
    JSON = "/json"
    CALC = "/calc"

class LocustImpl(FastHttpUser):

    @task
    def root(self):
        self.client.get(TargetURL.ROOT)

    @task
    def string(self):
        self.client.get(TargetURL.STRING)

    @task
    def json(self):
        self.client.get(TargetURL.JSON)

    @task
    def calc(self):
        self.client.get(TargetURL.CALC)
# terminal 실행
> locust

[2023-03-15 13:46:03,592] ujong-guui-MacBookPro.local/INFO/locust.main: Starting web interface at http://0.0.0.0:8089 (accepting connections from all network interfaces)
[2023-03-15 13:46:03,598] ujong-guui-MacBookPro.local/INFO/locust.main: Starting Locust 2.15.0

 

테스트 진행

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)
'Python/Open Source' 카테고리의 다른 글
  • [Python] 파이썬 출력 문자 색 변경하기
  • [Locust] 2. Locust를 통한 언어와 프레임워크 별 테스트
  • ChatGPT를 이용한 간단한 Web App 만들기 (python, streamlit)
  • [Python] Colorful print
상쾌한기분
상쾌한기분
  • 상쾌한기분
    상쾌한기분
    상쾌한기분
  • 전체
    오늘
    어제
    • 분류 전체보기 (250)
      • Python (44)
        • Python (26)
        • Django (6)
        • Flask (4)
        • Open Source (6)
      • Kotlin & Java (5)
        • Spring (2)
        • 프로젝트 (1)
      • Go (11)
      • Database (24)
        • MySQL (21)
        • Redis (3)
      • Infrastructure (2)
        • CDC (4)
        • Kafka (5)
        • Prometheus (2)
        • Fluentd (11)
        • Docker (1)
        • Airflow (2)
        • VPN (2)
      • IT (25)
        • AI (9)
        • Langchain (8)
        • Web (18)
        • Git (8)
        • 리팩토링 (9)
        • Micro Service Architecture (8)
        • Clean Code (16)
        • Design Pattern (0)
        • 수학 (1)
        • 알고리즘 (14)
      • OS (14)
        • Centos (10)
        • Ubuntu (3)
        • Mac (1)
      • Search Engine (2)
        • ElasticSearch (1)
        • Lucene Solr (1)
      • PHP (2)
        • Laravel (1)
        • Codeigniter (1)
  • 블로그 메뉴

    • Github 방문
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    오블완
    performance
    백준
    Redis
    docker
    http
    python
    fluentd
    CDC
    Golang
    티스토리챌린지
    git
    prompt
    Langchain
    go
    Kafka
    파이썬
    LLM
    ollama
    MYSQL
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
상쾌한기분
[Locust] 1. Locust 부하 테스트 툴(load testing tool)
상단으로

티스토리툴바