Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature : Load Test #5

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ There is another postprocessing option that supports distance threshold between
```
pip install raster2polygon
```

## Load Testing

In order to perform load testing we use Locust , To enable this hit following command within the root dir
**Caution : Always take permission of server admin before you perform load test**

```
locust -f locust.py
```
Populate your HOST and replace it with BASE URL of the Predictor URL

34 changes: 34 additions & 0 deletions locust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from locust import HttpUser, between, task


class MyUser(HttpUser):
wait_time = between(1, 3) # Time between requests

@task
def predict_api(self):
payload = {
"bbox": [
100.56228021333352,
13.685230854641182,
100.56383321235313,
13.685961853747969,
],
"checkpoint": "/mnt/efsmount/data/trainings/dataset_58/output/training_324/checkpoint.tflite",
"zoom_level": 20,
"source": "https://tiles.openaerialmap.org/6501a65c0906de000167e64d/0/6501a65c0906de000167e64e/{z}/{x}/{y}",
"use_josm_q": "false",
"merge_adjacent_polygons": "true",
"confidence": 50,
"max_angle_change": 15,
"skew_tolerance": 15,
"tolerance": 0.5,
"area_threshold": 3,
"tile_overlap_distance": 0.15,
}

headers = {"Content-Type": "application/json"}

response = self.client.post("predict/", json=payload, headers=headers)

# Print response status code and content
print(f"Response Status Code: {response.status_code}, Content: {response.text}")