title: Django: Pooling MySQL DB Connections
body: <p>I have a Django App with a pretty standard server stack</p>
  
  <ul>
  <li>DB Backend : MySQL</li>
  <li>WSGI Server : Gunicorn</li>
  <li>Async worker class : Gevent </li>
  </ul>
  
  <p>I want Django to pool MySQL connections rather than creating connections on every request. </p>
  
  <p>Starting 1.6, Django has introduced <a href="https://docs.djangoproject.com/en/1.9/ref/databases/#persistent-connections" rel="nofollow noreferrer">persistent connections</a> but there are <a href="https://github.com/benoitc/gunicorn/issues/996" rel="nofollow noreferrer">issues</a> with async workers.</p>
  
  <p>Hence, either a different MySQL backend is required or app level connection pooling. I've read several of them. Some of them are very old articles. Following are some:</p>
  
  <p><strong>Django MySQL backends</strong></p>
  
  <ol>
  <li><a href="https://github.com/smartfile/django-mysqlpool" rel="nofollow noreferrer">django-mysqlpool</a></li>
  </ol>
  
  <p><strong>App level Connection pool</strong></p>
  
  <ol>
  <li><a href="http://sonofacoder.com/index.php/django-mysql-connection-pooling-and-ssl/" rel="nofollow noreferrer">with SQL Alchemy</a></li>
  <li><a href="http://techualization.blogspot.in/2012/09/database-connection-pooling-in-django.html" rel="nofollow noreferrer">another with SQL Alchemy</a></li>
  </ol>
  
  <p><strong>Some Patches are also available</strong></p>
  
  <ol>
  <li><a href="https://stackoverflow.com/a/6712190/820410">Django Patch</a></li>
  </ol>
  
  <p><strong>Some other approaches</strong></p>
  
  <ol>
  <li><a href="https://dev.mysql.com/doc/connector-python/en/connector-python-connection-pooling.html" rel="nofollow noreferrer">MySQL DB Connector</a></li>
  </ol>
  
  <p>I'm really confused as to which approach among these is the best way to pool connections? Any Help is highly appreciated.</p>