Skip to content

Add benchmark script#109

Open
drdrsh wants to merge 4 commits intopostgresml:mainfrom
drdrsh:mostafa_add-benchmark-script
Open

Add benchmark script#109
drdrsh wants to merge 4 commits intopostgresml:mainfrom
drdrsh:mostafa_add-benchmark-script

Conversation

@drdrsh
Copy link
Copy Markdown
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

Comment thread benchmark/run_benchmark.sh Outdated
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
Copy Markdown
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.

Comment thread benchmark/run_benchmark.sh Outdated
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
Copy Markdown
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
Copy Markdown
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