Skip to content
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

Add benchmark script #109

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

drdrsh
Copy link
Collaborator

@drdrsh drdrsh commented Aug 5, 2022

This PR adds docker-based benchmark that allows a fair performance comparison between Pgcat, Pgbouncer and Postgres baseline.
I am using the same base image for both proxies and subjecting them to the same load to be able to do apples-to-apples comparison.

You will need docker for this. To run the benchmark do

cd benchmark
./run_benchmark.sh

Optionally you can specify any of the following flags

--pgcat-only to run only pgcat benchmark
--pgbouncer-only to run only pgbouncer benchmark
--recompile to recompile pgcat before running the benchmark

You can also modify benchmark/pgbouncer/pgbouncer.ini and benchmark/pgcat/pgcat.toml to change proxy configs used for the benchmarks

echo "================================================"
echo "[Pgbouncer] Running test directly against the DB"
echo "================================================"
docker compose exec --env PGPASSWORD=main_user proxy pgbench -t 1000 -c 128 -j 2 -p 5432 -h 127.0.0.1 -U main_user -S --protocol extended shard0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna need more than 1000 transactions to get a meaningful result.

docker compose up -d
wait_for_containers

docker compose exec --env PGPASSWORD=main_user proxy pgbench -p 6432 -h 127.0.0.1 -U main_user -i shard0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to dump the db and recreate it. Bloat from benchmark slows it down.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure docker compose down -v clears the volumes so there should be no history after it runs but I went ahead and added logic to drop the database and recreate it.

@drdrsh drdrsh requested a review from levkk August 5, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants