Open Bug 1119339 Opened 10 years ago Updated 10 years ago

Enable database connection reuse in Django

Categories

(www.mozilla.org :: Bedrock, defect)

Production
defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: pmac, Unassigned)

Details

(Whiteboard: [kb=1630761] [data: consultative])

Django 1.6 comes with the ability to reuse db connections natively (i.e. without a separate connection pooling proxy). We'd like to enable this after we've moved to 1.6.
To do this we set CONN_MAX_AGE to some number of seconds. According to the docs[0] this number should be lower than the DB server's idle timeout. Sheeri, can you tell us what the bedrock cluster's servers settings are for this kind of thing, and/or give us a recommended value for this setting. [0] https://docs.djangoproject.com/en/1.7/ref/databases/#persistent-database-connections
Flags: needinfo?(scabral)
The timeout is 600 seconds, or 10 minutes. CONN_MAX_AGE is the maximum age that a connection is used/reused before django kills it. The problem is that you might build up too many connections if django does not kill a thread, but in this case django is reusing them, so theoretically you won't build up connections, because if you have an idle connection, a "new" connection will just use the idle one. I would *think* that in that case, setting it to "None" is appropriate - letting the db kill a persistent connection that's idle for longer than the system timeout. However, I would test this on staging. That's what it's for. My team is happy to be there while you test, looking at # of database connections and seeing if it goes up drastically during a, say, 15 minute test.
Flags: needinfo?(scabral)
Sounds great Sheeri! We'll do that and let you know when we're ready to test. Thanks!
Whiteboard: [kb=1630761]
Whiteboard: [kb=1630761] → [kb=1630761] [data: consultative]
You need to log in before you can comment on or make changes to this bug.