Skip to content

Commit

Permalink
Merge pull request #19 from yuriihavrylko/feature/l11t1-load-test
Browse files Browse the repository at this point in the history
L11T1 Load testing with locust
  • Loading branch information
yuriihavrylko authored Feb 14, 2024
2 parents 44d05bf + 64e6f3b commit 4cb58d7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ kubectl create -f deployment/kserve.yaml
kubectl get inferenceservice custom-model
```


### Load testing

![Alt text](assets/locust.png)

```
locust -f benchmarks/load_test.py --host=http://localhost:9933 --users 50 --spawn-rate 10 --autostart --run-time 600s
### DVC
Install DVC
Expand Down
1 change: 1 addition & 0 deletions app/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ accelerate==0.25.0
datasets==2.16.1
wandb==0.16.1
httpx==0.23.0
locust==2.20.1
ipykernel==6.28.0
Binary file added assets/locust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions benchmarks/load_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import numpy as np
from locust import HttpUser, between, task

movie_reviews = [
"Scientists Discover New Species in Amazon Rainforest",
"Breakthrough in Cancer Research Offers Hope for Patients",
"Global Leaders Unveil Plan for Sustainable Energy Future",
"Artificial Intelligence Revolutionizing Healthcare Diagnostics",
"Mars Rover Sends Stunning Images of Martian Landscape",
"World-renowned Chef Opens Innovative Plant-Based Restaurant",
"International Space Station Celebrates 25 Years in Orbit",
"Groundbreaking Study Reveals Secrets of Longevity",
"Major Tech Company Launches Cutting-edge Augmented Reality Device",
"Humanitarian Aid Reaches Remote Areas Amidst Global Crisis"
]


class PredictUser(HttpUser):
wait_time = between(1, 5)

@task
def predict(self):
num_of_review = np.random.randint(1, 100)
reviews = np.random.choice(movie_reviews, size=num_of_review, replace=True)
self.client.post("/predict", json={"text": reviews.tolist()})

0 comments on commit 4cb58d7

Please sign in to comment.