This commit is contained in:
Siarhei Fedartsou 2024-05-26 18:07:30 +02:00
parent 18936a52c6
commit feafb25f8f
2 changed files with 24 additions and 23 deletions

View File

@ -30,21 +30,21 @@ class OSRMTasks(TaskSet):
self.client.get(f"/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true")
@task
def get_table(self):
num_coords = random.randint(3, 500)
selected_coords = random.sample(self.coordinates, num_coords)
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
# @task
# def get_table(self):
# num_coords = random.randint(3, 500)
# selected_coords = random.sample(self.coordinates, num_coords)
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
self.client.get(f"/table/v1/driving/{coords_str}")
# self.client.get(f"/table/v1/driving/{coords_str}")
@task
def get_match(self):
track_id = random.choice(self.track_ids)
track_coords = self.tracks[track_id]
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords])
# @task
# def get_match(self):
# track_id = random.choice(self.track_ids)
# track_coords = self.tracks[track_id]
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords])
self.client.get(f"/match/v1/driving/{coords_str}?steps=true")
# self.client.get(f"/match/v1/driving/{coords_str}?steps=true")
@task
def get_nearest(self):
@ -53,13 +53,13 @@ class OSRMTasks(TaskSet):
self.client.get(f"/nearest/v1/driving/{coord_str}")
@task
def get_trip(self):
num_coords = random.randint(2, 10)
selected_coords = random.sample(self.coordinates, num_coords)
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
# @task
# def get_trip(self):
# num_coords = random.randint(2, 10)
# selected_coords = random.sample(self.coordinates, num_coords)
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
self.client.get(f"/trip/v1/driving/{coords_str}?steps=true")
# self.client.get(f"/trip/v1/driving/{coords_str}?steps=true")
class OSRMUser(HttpUser):
tasks = [OSRMTasks]

View File

@ -27,14 +27,15 @@ function run_benchmarks_for_folder {
$BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf
$BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm
$BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm
$BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm
# TODO: save results
if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then
$BINARIES_FOLDER/osrm-routed --algorithm mld $FOLDER/data.osrm &
OSRM_ROUTED_PID=$!
# TODO: save results
if [ -f "$FOLDER/locustfile.py" ]; then
curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
locust -f $FOLDER/locustfile.py --headless --users 10 --spawn-rate 1 --host http://localhost:5000 --run-time 1m --csv=results
locust -f $FOLDER/scripts/ci/locustfile.py --headless --users 10 --spawn-rate 1 --host http://localhost:5000 --run-time 1m --csv=results --loglevel ERROR
echo "STATS: "
cat results_stats.csv