go build
Set the following environment variable:
- DATABASE_URL
Set the DATABASE_URL
according to the PostgreSQL URL format, plus the maximal pool connection size : postgres://YourUserName:YourURLEscapedPassword@YourHostname:5432/YourDatabaseName?sslmode=verify-full&pool_max_conns=50
.
❗ Remember to URL-escape the password, you can do it in bash:
python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])" 'YourPassword'
Run the tests.
Insert by inserting multiple values:
LEAF_HUBS_NUMBER=1000 BATCH_SIZE=10000 INSERT_MULTIPLE_VALUES= ./bin/db-performance-tests
Insert by the COPY protocol:
LEAF_HUBS_NUMBER=1000 BATCH_SIZE=20000 INSERT_COPY= ./bin/db-performance-tests
Define the REGISTRY
environment variable.
make build-images
-
Create a secret with your database url:
kubectl create secret generic hub-of-hubs-perf-database-secret --kubeconfig $TOP_HUB_CONFIG --from-literal=url=$DATABASE_URL -n myproject
-
Deploy the container:
IMAGE_TAG=latest COMPONENT=$(basename $(pwd)) envsubst < deploy/operator.yaml.template | kubectl apply -n myproject --kubeconfig $TOP_HUB_CONFIG -f -
-
Connect to the pod:
kubectl exec -it -n myproject --kubeconfig $TOP_HUB_CONFIG $(kubectl get pods -l name=db-performance-tests -n myproject --kubeconfig $TOP_HUB_CONFIG -o jsonpath='{.items..metadata.name}') -- bash
-
Run the tests (the executable is
/usr/local/bin/db-performance-tests
, available via thePATH
environment variable)
sudo dnf module install postgresql:13 -y
sudo dnf install git wget emacs make -y
git clone https://github.com/stolostron/hub-of-hubs-postgresql
cd hub-of-hubs-postgresql/
git checkout perf
cd db-performance-tests/
wget https://golang.org/dl/go1.16.6.linux-amd64.tar.gz
sha256sum go1.16.6.linux-amd64.tar.gz
Verify the checksum at Go downloads.
sudo tar -zxvf go1.16.6.linux-amd64.tar.gz -C /usr/local/
rm -rf go1.16.6.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
make build