mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(fix) load test run over 300s
This commit is contained in:
parent
1b63748831
commit
04ef2f2023
3 changed files with 35 additions and 39 deletions
36
.github/workflows/locustfile.py
vendored
36
.github/workflows/locustfile.py
vendored
|
@ -1,14 +1,16 @@
|
|||
from locust import HttpUser, task, between
|
||||
from locust import HttpUser, task, between, events
|
||||
import json
|
||||
import time
|
||||
|
||||
|
||||
class MyUser(HttpUser):
|
||||
wait_time = between(1, 5)
|
||||
|
||||
@task
|
||||
@task(3)
|
||||
def chat_completion(self):
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer sk-1234",
|
||||
"Authorization": f"Bearer sk-mh3YNUDs1d_f6fMXfvEqBA",
|
||||
# Include any additional headers you may need for authentication, etc.
|
||||
}
|
||||
|
||||
|
@ -26,3 +28,31 @@ class MyUser(HttpUser):
|
|||
response = self.client.post("chat/completions", json=payload, headers=headers)
|
||||
|
||||
# Print or log the response if needed
|
||||
|
||||
@task(10)
|
||||
def health_readiness(self):
|
||||
start_time = time.time()
|
||||
response = self.client.get("health/readiness")
|
||||
response_time = time.time() - start_time
|
||||
if response_time > 1:
|
||||
events.request_failure.fire(
|
||||
request_type="GET",
|
||||
name="health/readiness",
|
||||
response_time=response_time,
|
||||
exception=None,
|
||||
response=response,
|
||||
)
|
||||
|
||||
@task(10)
|
||||
def health_liveliness(self):
|
||||
start_time = time.time()
|
||||
response = self.client.get("health/liveliness")
|
||||
response_time = time.time() - start_time
|
||||
if response_time > 1:
|
||||
events.request_failure.fire(
|
||||
request_type="GET",
|
||||
name="health/liveliness",
|
||||
response_time=response_time,
|
||||
exception=None,
|
||||
response=response,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue