mirror of
https://github.com/suitenumerique/meet.git
synced 2026-10-20 03:31:55 +00:00
⚡️(backend) add opt-in psycopg connection pool
Each request opened and closed its own Postgres connection which added a big overhead. The goal is to add Django's native psycopg pool behind a new DB_PSYCOPG_POOL_ENABLED settings with explicit min/max size and keepalive. Each pool lives in one process, and gunicorn's sync workers serve a single request at a time which means that a given worker won't use more than one connection. The default pool minimum size is set to 1, which keeps always one connection open and the maximum size to 3 as headroom for code touching the database from an extra thread. Pooled connections can sit idle for hours, so TCP keepalives are enabled to keep load balancers and NAT from dropping them silently, and each connection is health checked on checkout so a broken one is replaced instead of failing the request.
This commit is contained in:
@@ -318,12 +318,17 @@ These are the environmental options available on meet backend.
|
||||
| DJANGO_SECRET_KEY | Secret key used for Django security | |
|
||||
| DJANGO_SILENCED_SYSTEM_CHECKS | Silence Django system checks | [] |
|
||||
| DJANGO_ALLOW_UNSECURE_USER_LISTING | Allow unsecure user listing | false |
|
||||
| DB_ENGINE | Database engine used | django.db.backends.postgresql_psycopg2 |
|
||||
| DB_ENGINE | Database engine used | django.db.backends.postgresql |
|
||||
| DB_NAME | Name of the database | meet |
|
||||
| DB_USER | User used to connect to database | dinum |
|
||||
| DB_PASSWORD | Password used to connect to the database | pass |
|
||||
| DB_HOST | Hostname of the database | localhost |
|
||||
| DB_PORT | Port to connect to database | 5432 |
|
||||
| DB_PSYCOPG_POOL_ENABLED | Enable the psycopg connection pool | false |
|
||||
| DB_PSYCOPG_POOL_MIN_SIZE | Connections each pool keeps open | 1 |
|
||||
| DB_PSYCOPG_POOL_MAX_SIZE | Maximum connections per pool | 3 |
|
||||
| DB_PSYCOPG_POOL_TIMEOUT | Seconds a request waits for a free pool connection before failing | 30 |
|
||||
| DB_PSYCOPG_POOL_MAX_IDLE | Seconds an idle connection above the minimum stays open | 600 |
|
||||
| STORAGES_STATICFILES_BACKEND | Static file serving engine | whitenoise.storage.CompressedManifestStaticFilesStorage |
|
||||
| AWS_S3_ENDPOINT_URL | S3 host endpoint | |
|
||||
| AWS_S3_ACCESS_KEY_ID | S3 access key | |
|
||||
|
||||
Reference in New Issue
Block a user