Implement end-to-end benchmark

This commit is contained in:
Siarhei Fedartsou 2024-05-26 13:06:40 +02:00
parent f1435c16ea
commit 35458f143d

View File

@ -107,42 +107,45 @@ jobs:
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- run: pip install locust
- name: Enable osm.pbf cache - name: Enable osm.pbf cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: germany-latest.osm.pbf path: berlin-latest.osm.pbf
key: v1-germany-osm-pbf key: v1-berlin-osm-pbf
restore-keys: | restore-keys: |
v1-germany-osm-pbf v1-berlin-osm-pbf
- name: Docker build - name: Docker build
run: | run: |
docker build -t osrm-backend-local -f docker/Dockerfile . docker build -t osrm-backend-local -f docker/Dockerfile .
- name: Test Docker image - name: Test Docker image
run: | run: |
if [ ! -f "${PWD}/germany-latest.osm.pbf" ]; then if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
wget http://download.geofabrik.de/europe/germany/germany-latest.osm.pbf wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
fi fi
TAG=osrm-backend-local TAG=osrm-backend-local
# when `--memory-swap` value equals `--memory` it means container won't use swap # when `--memory-swap` value equals `--memory` it means container won't use swap
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details # see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
MEMORY_ARGS="--memory=1g --memory-swap=1g" MEMORY_ARGS="--memory=1g --memory-swap=1g"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/germany-latest.osm.pbf docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/germany-latest.osrm.nbg /data/germany-latest.geojson docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
# if [ ! -s "${PWD}/berlin-latest.geojson" ] if [ ! -s "${PWD}/berlin-latest.geojson" ]
# then then
# >&2 echo "No berlin-latest.geojson found" >&2 echo "No berlin-latest.geojson found"
# exit 1 exit 1
# fi fi
# removing `.osrm.nbg` to check that whole pipeline works without it # removing `.osrm.nbg` to check that whole pipeline works without it
# rm -rf "${PWD}/berlin-latest.osrm.nbg" rm -rf "${PWD}/berlin-latest.osrm.nbg"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/germany-latest.osrm docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/germany-latest.osrm docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/germany-latest.osrm & docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
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" 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 locustfile.py --headless --users 10 --spawn-rate 1 --host http://localhost:5000 --run-time 1m
docker stop osrm-container docker stop osrm-container
# build-test-publish: # build-test-publish:
# needs: format-taginfo-docs # needs: format-taginfo-docs
# strategy: # strategy: