Skip to content

Commit

Permalink
Merge pull request #5 from hotosm/feature/locust
Browse files Browse the repository at this point in the history
Feature : Load Test
  • Loading branch information
kshitijrajsharma authored Dec 7, 2023
2 parents ea61c87 + 3591342 commit fff6592
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
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}")

0 comments on commit fff6592

Please sign in to comment.