Databases & System Design•Part 1: Candid Database Experience & Intro Scenarios (1 - 5)
Strategy for database security and connection pooling:
In Simple Words:
- Networking: Databases live in private VPC subnets with zero public internet access; SSL enforced.
- Pooling: Use proxy poolers like PgBouncer to prevent thousands of client connections from exhausting database memory.
- Credentials: Passwords hashed with
bcrypt/argon2; sensitive PII encrypted at rest.
ini
; PgBouncer pool configuration snippet (pgbouncer.ini):
[databases]
mydb = host=127.0.0.1 port=5432 dbname=production
[pgbouncer]
listen_port = 6432
pool_mode = transaction
max_client_conn = 5000
default_pool_size = 50
reserve_pool_size = 10