LiteLLM Proxy - Locust 로드 테스트

LiteLLM Proxy - Locust 로드 테스트

Locust를 사용해 LiteLLM 프록시를 로드 테스트하는 방법을 알려드릴게요.

출처: 문서

본문

Locust로 LiteLLM 프록시 로드 테스트하기

  1. 프록시 config.yamlfake-openai-endpoint를 추가하고 litellm 프록시를 시작하세요. LiteLLM은 로드 테스트할 수 있는 **무료 호스팅 fake-openai-endpoint**를 제공해요. 직접 만든 fake OpenAI 프록시 서버는 github.com/BerriAI/example_openai_endpoint로 셀프호스팅할 수도 있어요.
model_list:
  - model_name: fake-openai-endpoint
    litellm_params:
      model: openai/fake
      api_key: fake-key
      api_base: https://exampleopenaiendpoint-production.up.railway.app/
  1. uv add locust 실행

  2. 로컬 머신에 locustfile.py 파일을 만드세요. 여기 있는 litellm 로드 테스트 내용을 복사하세요.

  3. Locust 시작 — 2단계의 locustfile.py와 같은 디렉터리에서 locust 실행

locust

터미널 출력:

[2024-03-15 07:19:58,893] Starting web interface at http://0.0.0.0:8089
[2024-03-15 07:19:58,898] Starting Locust 2.24.0
  1. Locust에서 로드 테스트 실행 — http://0.0.0.0:8089의 locust UI로 이동

    • Users=100 설정
    • Ramp Up Users=10 설정
    • Host=LiteLLM Proxy의 Base URL 설정
  2. 예상 결과/health/readiness에 대해 다음 응답 시간을 기대해요:

    • Median → /health/readiness은 150ms
    • Avg → /health/readiness은 219ms

더 알아보기 (Learn more)