Using Django Connection Pooling
There are so many applications where database connection pooling makes sense, including web sites which have many users. I’ve written various posts over the years about pooling. Along with performance benefits, Oracle Database driver connection pools also have a lot of inbuilt smarts related to load balancing and high availability, so it is logical to use them where possible. However currently the Django web framework doesn’t.
No fear! Our Oracle Database driver team has created a GitHub Pull Request to add python-oracledb connection pooling to Django. We, and the Django maintainers, are wisely looking for some broader user feedback before the PR will be merged and hopefully become available in Django 5.2. [Update the PR has been merged to the main branch!]
To try it out, see the blog post Boost your Application Performance with Oracle Connection Pooling in Django for details. Once you have pulled the PR, you can update your Django settings file and away you go:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.oracle",
"OPTIONS": {
"pool": {
"min": 1,
"max": 4,
"increment": 1,
# Additional parameters can be added here
}
}
},
}
Please let us know if you use it, and send us feedback — good or bad.