-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·28 lines (19 loc) · 1.03 KB
/
benchmark.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -e
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# install ghz
curl -sSL https://github.com/bojand/ghz/releases/download/v0.114.0/ghz-linux-x86_64.tar.gz | tar xvz
mv ghz /usr/local/bin
CONTAINER_ID=$(docker run -d -p 50051:50051 -v $SCRIPTPATH/tiles:/tiles -it mama-server mama_server /tiles)
trap "docker kill $CONTAINER_ID" EXIT
# TODO: add normal healthcheck
sleep 10
# without state
DATA='{"entries": [{"location": {"longitude": 21.0245, "latitude": 52.2441}}]}'
echo "Results without state:"
ghz --total 100000 --insecure --proto $SCRIPTPATH/protos/mama.proto --call mama.server.api.MamaService.Match --data "$DATA" localhost:50051
# with state
STATE=$(node $SCRIPTPATH/benchmark_get_state.js 21.01822 52.24858)
DATA="{\"entries\": [{\"state\": \"${STATE}\", \"location\": {\"longitude\": 21.0245, \"latitude\": 52.2441}}]}"
echo "Results with state(${STATE}):"
ghz --total 100000 --insecure --proto $SCRIPTPATH/protos/mama.proto --call mama.server.api.MamaService.Match --data "$DATA" localhost:50051