Skip to content

Latest commit

 

History

History

db-performance-tests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Performance tests for Hub-of-hubs database

Build

go build

Run

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

Build image

Define the REGISTRY environment variable.

make build-images

Deploy to a cluster

  1. 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
    
  2. Deploy the container:

    IMAGE_TAG=latest COMPONENT=$(basename $(pwd)) envsubst < deploy/operator.yaml.template | kubectl apply -n myproject --kubeconfig $TOP_HUB_CONFIG -f -
    
  3. 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
    
  4. Run the tests (the executable is /usr/local/bin/db-performance-tests, available via the PATH environment variable)

Setting a client on RHEL

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