Skip to content

ozontech/pg_doorman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

330 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg_doorman

PgDoorman

BDD Tests License: MIT Docs Telegram

A multithreaded PostgreSQL connection pooler in Rust (MSRV 1.87). Alternative to PgBouncer, Odyssey, and PgCat. In production at Ozon for over three years across Go (pgx), .NET (Npgsql), Python (asyncpg, SQLAlchemy), and Node.js workloads.

📖 Full documentation: ozontech.github.io/pg_doorman

Configuration reference, tutorials, comparison with PgBouncer and Odyssey, benchmarks, deployment guides — all on the documentation site.

Available in English and Русский.

Quick start

docker run -p 6432:6432 \
  -v $(pwd)/pg_doorman.yaml:/etc/pg_doorman/pg_doorman.yaml \
  ghcr.io/ozontech/pg_doorman

Generate a config from your PostgreSQL:

pg_doorman generate --host db.example.com --user postgres --output pg_doorman.yaml

Connect and verify:

psql -h 127.0.0.1 -p 6432 -U admin pgdoorman -c "SHOW VERSION;"

For installation from source, distribution packages (Ubuntu PPA, Fedora COPR), and the tls-migration build, see the Installation guide.

Highlights

  • Multithreaded — one process, one shared pool across all worker threads.
  • Anonymous prepared statements get plan caching — PgBouncer 1.21+ and Odyssey forward the empty-name Parse unchanged and re-plan on every Bind; pg_doorman remaps it to DOORMAN_<N> so the plan lands in the backend's named registry and gets reused across clients sharing the pool. Learn more.
  • Pool Coordinator — database-level connection cap with priority eviction and per-user minimums. Learn more.
  • Patroni-assisted fallback — automatic backend rerouting via the Patroni REST API when the local node fails. Learn more.
  • Graceful binary upgrade — replace the binary without dropping clients; TLS connections migrate cleanly with the tls-migration cargo feature. Learn more.
  • Built-in observability — Prometheus /metrics with HDR-histogram percentiles, structured JSON logs, admin SHOW commands.

Full feature comparison →

Benchmarks

Continuously updated pgbench results from AWS Fargate and Ubicloud (multiple scenarios) live on the benchmarks page. PgDoorman runs 3-4× ahead of PgBouncer on extended-protocol and prepared-statement workloads, and noticeably ahead of Odyssey under the same scenarios.

Community

License

MIT — see LICENSE.

Packages

 
 
 

Contributors