Skip to content

Tune Django settings for highload readiness#2

Merged
ak4code merged 1 commit into
mainfrom
claude/nifty-euler-my09oj
Jun 12, 2026
Merged

Tune Django settings for highload readiness#2
ak4code merged 1 commit into
mainfrom
claude/nifty-euler-my09oj

Conversation

@ak4code

@ak4code ak4code commented Jun 12, 2026

Copy link
Copy Markdown
Owner
  • Enable native psycopg connection pooling for PostgreSQL (DJANGO_DB_POOL, min/max size and timeout via env); fall back to persistent connections with health checks for other engines
  • Move sessions to cached_db backend: reads served from Redis, write-through to DB so sessions survive cache flush
  • Tune Redis cache client: connection pool size, socket timeouts, retry_on_timeout, health checks, configurable key prefix
  • Switch default password hasher to Argon2 (argon2-cffi), keeping legacy hashers for transparent migration of existing passwords
  • Add UserRateThrottle alongside AnonRateThrottle with env-driven rates
  • Set NUM_PROXIES in prod for correct client IP behind reverse proxy
  • Reduce 4xx log noise via django.request logger level (default ERROR)
  • Tune gunicorn: workers default to CPU*2+1, gthread worker class with configurable threads, /dev/shm heartbeat dir, backlog 2048, graceful timeout, keep-alive 5
  • Document new env vars in .env.example and README

- Enable native psycopg connection pooling for PostgreSQL
  (DJANGO_DB_POOL, min/max size and timeout via env); fall back to
  persistent connections with health checks for other engines
- Move sessions to cached_db backend: reads served from Redis,
  write-through to DB so sessions survive cache flush
- Tune Redis cache client: connection pool size, socket timeouts,
  retry_on_timeout, health checks, configurable key prefix
- Switch default password hasher to Argon2 (argon2-cffi), keeping
  legacy hashers for transparent migration of existing passwords
- Add UserRateThrottle alongside AnonRateThrottle with env-driven rates
- Set NUM_PROXIES in prod for correct client IP behind reverse proxy
- Reduce 4xx log noise via django.request logger level (default ERROR)
- Tune gunicorn: workers default to CPU*2+1, gthread worker class with
  configurable threads, /dev/shm heartbeat dir, backlog 2048, graceful
  timeout, keep-alive 5
- Document new env vars in .env.example and README

https://claude.ai/code/session_01YZr4TbzTw6EkkFqZz2onTF
@ak4code ak4code merged commit 356d1f2 into main Jun 12, 2026
2 checks passed
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