django-mysqlpool 0.1-8

Django database backend for MySQL that provides pooling ala SQLAlchemy

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
MIT/X Consortium License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Ben Timby
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Internet \ Django Plugins
django-mysqlpool is a simple Django database backend that pools MySQL connections. This backend is based on a blog post by Ed Menendez.

http://menendez.com/blog/mysql-connection-pooling-django-and-sqlalchemy/

The main differences being:

1. The work is done for you.
2. Instead of cloning the Django mysql backend, we import it.

The actual pooling is done using SQLAlchemy. While imperfect (this backend is per-process only) it has usefulness. The main problem it solves for us is that it restricts a process to a certain number of total connections.

Usage

Configure this backend instead of the default Django mysql backend.

DATABASES = {
 'default': {
 'ENGINE': 'django_mysqlpool.backends.mysqlpool',
 'NAME': 'db_name',
 'USER': 'username',
 'PASSWORD': 'password',
 'HOST': '',
 'PORT': '',
 },
}


Configuration

There are a number of additional options that can be configured in settings.py:

- MYSQLPOOL_MAX - The number of connections allowed in the pool.
- MYSQLPOOL_OVERFLOW - The number of connections beyond max that can be used temporarily (burst).
- MYSQLPOOL_RECYCLE - The time (in seconds) before a connection is reaped. This value should be less than the configured timeout value in MySQL. Mysql's default is 120s, so the default recycle interval is 119s.
- MYSQLPOOL_TIMEOUT - The amount of time to wait for a new connection to complete before aborting.

Last updated on September 23rd, 2012

requirements

#database backend #MySQL pooling #Django #database #backend #MySQL

Add your review!

SUBMIT