Mike, As of version 1.6, Django supports persistent DB connections (connection pooling). CONN_MAX_AGE specifies the number of seconds that a connection will remain open and be reused. You can set it to 0 to cause each DB interaction to open, use, and close its own connection. You can set it to None to allow an unlimited number of connections. See: - https://docs.djangoproject.com/en/dev/ref/databases/ However, the behavior you're seeing doesn't seem to match this documented behavior. I'd have expected CONN_MAX_AGE = 0 to prevent connections from being reused, so they should be closed at the end of the request that used them. So, unless you have 65 or more concurrent requests, you should not be hitting your limit. I'm not surprised that CONN_MAX_AGE = None has an effect, but I wouldn't have been able to predict whether it makes things better or worse. It allows Django to reuse connections so fewer of them should be created, but it also allows Django to pool them for as long as it likes, so a large number of them may accumulate. Have you tried any other values for CONN_MAX_AGE, like 1 or 2? Also, are you using the Django development server? The docs linked above say: "The development server creates a new thread for each request it handles, negating the effect of persistent connections. Don’t enable them during development." --Fred
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service! Open Source: Without walls and fences, we need no Windows or Gates. On 1/17/17 2:25 PM, Michael Grundler
wrote:
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6d7eefba-47ac-5a7c-a6b2-1bc38091f7e2%40bristle.com. For more options, visit https://groups.google.com/d/optout. |
- What is the fate of closed database connectio... Michael Grundler
- Re: What is the fate of closed database ... Fred Stluka
- Re: What is the fate of closed datab... Michael Grundler
- Re: What is the fate of closed d... Fred Stluka
- Re: What is the fate of clos... Michael Grundler
- Re: What is the fate of... Fred Stluka
- Re: What is the fate of closed datab... 'Tom Evans' via Django users
- Re: What is the fate of closed d... Michael Grundler