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)
This commit is contained in:
Tim Abbott 2013-11-08 11:35:40 -05:00
parent d13500ac0d
commit 98ad49c866
2 changed files with 2 additions and 0 deletions

View File

@ -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,

View File

@ -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
}