Skip to content

Ovh #168

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

Draft
wants to merge 19 commits into
base: development
Choose a base branch
from
Draft

Ovh #168

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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ bazel-*
tpcc/profiling/
ldbc/profiling/
*.json

# OpenStack credentials
openrc.sh
8 changes: 5 additions & 3 deletions tool/mongodb/install-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ set -eu

echo 'installing driver...'
sudo apt update -y
sudo apt install -y python3-pip
python3 -m pip install pymongo
echo 'installing driver done'
sudo apt install -y python3-pip python3-venv
if [ ! -x venv ]; then python3 -m venv venv; fi
. venv/bin/activate
pip install pymongo
echo 'installing driver done'
5 changes: 4 additions & 1 deletion tool/neo4j/install-driver.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
set -eu

sudo apt install -y python3-pip
sudo apt update -y
sudo apt install -y python3-pip python3-venv
if [ ! -x venv ]; then python3 -m venv venv; fi
. venv/bin/activate
pip install neo4j
2 changes: 1 addition & 1 deletion tool/neo4j/install-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ echo 'deb [signed-by=/etc/apt/keyrings/neotechnology.gpg] https://debian.neo4j.c
sudo apt update -y
sudo apt install -y neo4j=1:$SERVER_VERSION

sudo update-java-alternatives --jre --set java-1.21.0-openjdk-amd64
# sudo update-java-alternatives --jre --set java-1.21.0-openjdk-amd64
sudo sed -i 's/#dbms.security.auth_enabled=.*/dbms.security.auth_enabled=false/' /etc/neo4j/neo4j.conf
7 changes: 7 additions & 0 deletions tool/ovh/clone-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set -eu

tool/ovh/ssh-exec.sh "'git clone https://github.com/typedb/typedb-benchmark.git'"
if [ $# -eq 1 ]; then
REF=$1
tool/ovh/ssh-exec.sh "'cd typedb-benchmark && git fetch origin $REF && git checkout $REF'"
fi
12 changes: 12 additions & 0 deletions tool/ovh/create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set -eu

openstack server create "$MACHINE_NAME" \
--key-name "$OS_KEY_ID" \
--flavor "$MACHINE_TYPE" \
--image "$IMAGE" \
--network Ext-Net

for _ in `seq 60`; do
STATUS=$(openstack server show "$MACHINE_NAME" |& grep '\bstatus' | awk '{print $4}')
if [[ $STATUS == "ACTIVE" ]]; then break; fi
done
6 changes: 6 additions & 0 deletions tool/ovh/download-result.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
openstack server ssh $MACHINE_NAME -4 --address-type Ext-Net -- -i $OS_PRIVATE_KEY -l ubuntu -o StrictHostKeychecking=no "cat ~/typedb-benchmark/results.log" > result-$MACHINE_NAME.log
# resolve typedb folder using glob '*', as there's exactly one typedb folder
if [[ $DB =~ typedb ]]; then
openstack server ssh $MACHINE_NAME -4 --address-type Ext-Net -- -i $OS_PRIVATE_KEY -l ubuntu -o StrictHostKeychecking=no "cat ~/typedb-benchmark/typedb-all-linux-x86_64-*/log" > result-$MACHINE_NAME-server.log
fi

45 changes: 45 additions & 0 deletions tool/ovh/profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
set -eu

# TPCC config
DB=${DB:-typedb3}
source tool/$DB/config.sh # export the DB server and driver version
SCALE_FACTOR=${SCALE_FACTOR:-1} # 0.5, 1
WAREHOUSES=${WAREHOUSES:-1} # 1, 5, 10, --- 100, 300, 500, 1000
CLIENTS=${CLIENTS:-1} # 4, 8, 16, 32, 48, 64
DURATION=${DURATION:-600}

# machine config
MACHINE_TYPE=b2-15

# cloud provider config
if [ ! -v OS_TENANT_ID -o ! -v OS_TENANT_NAME ]; then
echo "OS_TENANT_ID and OS_TENANT_NAME must be set; download and source openrc.sh"
exit 1
fi

if [ ! -v OS_USERNAME -o ! -v OS_PASSWORD ]; then
echo "OS_USERNAME and OS_PASSWORD must be set; download and source openrc.sh"
exit 1
fi

if [ ! -v OS_KEY_ID -o ! -v OS_PRIVATE_KEY ]; then
echo "OS_KEY_ID and OS_PRIVATE_KEY must be set"
exit 1
fi

PROJECT=vaticle-engineers
ZONE=europe-west2-c
IMAGE="Ubuntu 24.10"
IMAGE_PROJECT=vaticle-factory-prod

# four digit random number with zero padding
ID=0000$RANDOM
ID=${ID:(-4)}

# extrapolation
DB_SHORT="${DB:0:1}${DB: -1}"
SERVER_VERSION_SHORT=${SERVER_VERSION:0:4}
SERVER_VERSION_SHORT=${SERVER_VERSION_SHORT//\./-} # replace '.'s in version with hyphens
DRIVER_VERSION_SHORT="eac3" # TODO: update according to DRIVER_VERSION
BENCH_ID=$USER-$DB_SHORT-$SERVER_VERSION_SHORT-$DRIVER_VERSION_SHORT-$MACHINE_TYPE-sf$SCALE_FACTOR-w$WAREHOUSES-c$CLIENTS-dur$DURATION-$ID
MACHINE_NAME=$BENCH_ID
3 changes: 3 additions & 0 deletions tool/ovh/ssh-exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -eu

openstack server ssh $MACHINE_NAME -4 --address-type Ext-Net -- -i $OS_PRIVATE_KEY -l ubuntu -o StrictHostKeychecking=no "$@"
3 changes: 3 additions & 0 deletions tool/ovh/ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -eu

openstack server ssh $MACHINE_NAME -4 --address-type Ext-Net -- -i $OS_PRIVATE_KEY -l ubuntu
56 changes: 56 additions & 0 deletions tool/ovh/tpcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
set -euo allexport

usage() {
echo "Usage: $0 [-d <neo4j|mongodb|postgres|typedb2|typedb3>] [-s SCALE_FACTOR] [-w WAREHOUSES] [-c CLIENTS] [-t DURATION] [-k]" 1>&2
echo "Default: $0 -d typedb3 -s 1 -w 1 -c 1 -t 600" 1>&2
echo "-d DATABASE target database"
echo "-s SCALE_FACTOR benchmark scale factor"
echo "-w WAREHOUSES number of warehouses"
echo "-c CLIENTS number of clients"
echo "-t DURATION how long to run the execution portion of the benchmark (seconds)"
echo "-k keep the server instance (default: deletes)"
exit 1
}

KEEP_SERVER=
while getopts ":d:w:c:s:t:k" opt; do
case $opt in
d) DB="$OPTARG" ;;
s) SCALE_FACTOR="$OPTARG" ;;
w) WAREHOUSES="$OPTARG" ;;
c) CLIENTS="$OPTARG" ;;
t) DURATION="$OPTARG" ;;
k) KEEP_SERVER=1 ;;
*) usage ;;
esac
done

source tool/ovh/profile.sh

echo Machine name: $MACHINE_NAME

function cleanup {
tool/ovh/download-result.sh

if [[ -z $KEEP_SERVER ]]; then
openstack server delete $MACHINE_NAME
fi
}
trap cleanup ERR
trap cleanup EXIT

tool/ovh/create.sh
sleep 40
tool/ovh/clone-repo.sh $(git rev-parse HEAD)

tool/ovh/ssh-exec.sh "'cd typedb-benchmark && tool/$DB/setup.sh'"

tool/ovh/ssh-exec.sh "'
cd typedb-benchmark && . venv/bin/activate &&
nohup tool/execute-tpcc.sh --no-execute --reset --scalefactor=$SCALE_FACTOR --warehouses=$WAREHOUSES --clients=$CLIENTS --duration=$DURATION $DB & wait \$!
'"

tool/ovh/ssh-exec.sh "'
cd typedb-benchmark && . venv/bin/activate &&
nohup tool/execute-tpcc.sh --no-load --scalefactor=$SCALE_FACTOR --warehouses=$WAREHOUSES --clients=$CLIENTS --duration=$DURATION $DB & wait \$!
'"
3 changes: 3 additions & 0 deletions tool/ovh/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -eu

tool/ovh/ssh-exec.sh "tail -n +1 -F typedb-benchmark/results.log"
4 changes: 3 additions & 1 deletion tool/postgres/install-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ set -eu

echo 'installing driver...'
sudo apt update -y
sudo apt install -y python3-pip
sudo apt install -y python3-pip python3-venv
if [ ! -x venv ]; then python3 -m venv venv; fi
. venv/bin/activate
pip install psycopg2-binary
echo 'installing driver done'
20 changes: 20 additions & 0 deletions tool/run_batched.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# usage: for ...; do echo cmd; done | run_batched.sh

MAX_JOBS=8

while true; do
CUR_JOBS=$(jobs | wc -l)
if ((CUR_JOBS < MAX_JOBS)); then
read cmd || break
echo "$cmd"
bash -c "$cmd" &
else
sleep 60
fi
done

echo "scheduled all jobs"

wait $(jobs -p)
6 changes: 4 additions & 2 deletions tool/typedb2/install-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ set -eu
source tool/typedb2/config.sh

sudo apt update -y
sudo apt install -y python3-pip
pip install typedb-driver=="$DRIVER_VERSION"
sudo apt install -y python3-pip python3-venv
if [ ! -x venv ]; then python3 -m venv venv; fi
. venv/bin/activate
pip install typedb-driver=="$DRIVER_VERSION"
4 changes: 2 additions & 2 deletions tool/typedb3/config.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -eu

SERVER_VERSION=3.1.0
DRIVER_VERSION=3.1.0
SERVER_VERSION=3.2.0
DRIVER_VERSION=3.2.0
4 changes: 3 additions & 1 deletion tool/typedb3/install-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ set -eu
source tool/typedb3/config.sh

sudo apt update -y
sudo apt install -y python3-pip
sudo apt install -y python3-pip python3-venv
if [ ! -x venv ]; then python3 -m venv venv; fi
. venv/bin/activate
pip install typedb-driver=="$DRIVER_VERSION" --extra-index-url https://repo.typedb.com/public/public-snapshot/python/simple/
2 changes: 1 addition & 1 deletion tool/typedb3/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source tool/typedb3/config.sh
# start server
DISTRIBUTION="typedb-all-linux-x86_64"
DISTRIBUTION_DIR="$DISTRIBUTION-$SERVER_VERSION"
tmux new-session -d -s "typedb" "./$DISTRIBUTION_DIR/typedb server > ./$DISTRIBUTION_DIR/log"
tmux new-session -d -s "typedb" "./$DISTRIBUTION_DIR/typedb server --server.http.enable false > ./$DISTRIBUTION_DIR/log"

# wait until ready
set +e
Expand Down