https://github.com/oshanz/pgbouncer-load-test
https://github.com/oshanz/pgbouncer-load-test
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oshanz/pgbouncer-load-test
- Owner: oshanz
- Created: 2024-08-03T02:20:12.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-07T12:29:49.000Z (9 months ago)
- Last Synced: 2025-02-18T04:06:38.089Z (2 months ago)
- Language: Ruby
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## scenarios
- io bound localhost:8080/cpu_intensive
- cpu bound localhost:8080/io_intensive100 vus, 10s
| unicorn workers | rails db pool | db connections | with pgbouncer pool size | transaction mode | throughput | 95th percentile |
| --- | --- | --- | --- | --- | --- | --- |
| 4 | 5 | 4*5 | 2 | session | 6 | 30798.33 |
| 4 | 5 | 4*5 | 10 | session | 13 | 30823.54 |
| 4 | 5 | 4*5 | 30 | session | 12 | 30832.44 |
| 4 | 1 | 4*1 | 30 | session | 12 | 30221.89 |### setup
```bashdocker-compose up
cd app
bundle install
bundle exec unicorn -c config/unicorn.conf.rb
```### run k6
```bash
brew install k6
k6 run script.js
# docker-compose run k6 run /app/script.js
```### Known issues
1. objc[69020]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
https://github.com/rails/rails/issues/38560`export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES`
### Notes
- https://eoinkelly.info/2023/01/06/rails-and-pgbouncer-notes#rails-and-pgbouncer
- https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing- select count(*) from pg_stat_activity where pid <> pg_backend_pid() and usename = current_user;
SELECT
pid,
user,
pg_stat_activity.query_start,
now() - pg_stat_activity.query_start AS query_time,
query,
state,
wait_event_type,
wait_event
FROM pg_stat_activity- psql -U postgres -h localhost -p 6432 pgbouncer
show pools;