From 98ad49c866e800305426a8760aa64cc51fef4c7f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 8 Nov 2013 11:35:40 -0500 Subject: [PATCH] Use persistent connections to our database. I figure we can start with 600s as a maximum age -- our threads do many dozens of requests per minute, so I figure we'll get most of the benefit of permanently persisting connections this way. I could also be convinced to do just 60s, though the impact will likely to be less visible on staging. 600s seems to be what Django originally had for this parameter before they disabled it by default. See: https://groups.google.com/forum/#!msg/django-developers/rH0QQP7tI6w/yBusiFTNBR4J for discussion, which also suggests we might have issues with runserver that we should watch out for. (imported from commit 0ae09fa4f1b39cc88c76fa58258aaf20ab168dcf) --- zproject/settings.py | 1 + zproject/test_settings.py | 1 + 2 files changed, 2 insertions(+) diff --git a/zproject/settings.py b/zproject/settings.py index d91aa6b4ff..fdbcc42203 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -60,6 +60,7 @@ DATABASES = {"default": { 'PASSWORD': '', # Authentication done via certificates 'HOST': 'postgres.zulip.net', 'SCHEMA': 'zulip', + 'CONN_MAX_AGE': 600, 'OPTIONS': { 'sslmode': 'verify-full', 'autocommit': True, diff --git a/zproject/test_settings.py b/zproject/test_settings.py index 4b89fce097..1327f45cf9 100644 --- a/zproject/test_settings.py +++ b/zproject/test_settings.py @@ -41,6 +41,7 @@ CACHES['database'] = { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', 'LOCATION': 'zulip-database-test-cache', 'TIMEOUT': 3600, + 'CONN_MAX_AGE': 600, 'OPTIONS': { 'MAX_ENTRIES': 100000 }