Redis connection pooling #17

merged 3 commits into from Mar 1, 2013


None yet

2 participants

zwant commented Mar 1, 2013

At the moment, the redis backend creates a new StrictRedis-object for every redis request. This essentially nulls out the built-in connection pooling in the StrictRedis-class. See .
One workaround in other forks has been to explicitly pass in a connection-pool object, but this is not optimal in situations like when using pyramid_beaker to set up the session-connection.

This pull request addresses this in a more general way, by internally keeping a dict of ConnectionPool objects, unique by host, port and db. If a new request is made for a redis db we've seen already, the existing ConnectionPool instance will be used.

Svante Paldan added some commits Feb 11, 2013
Svante Paldan Adding check for an existing redis-connection as we want to use the c…
…onnection pooling in redis-py which will be put out of play if we keep creating a new StrictRedis object on every request.
Svante Paldan Second go at pooling for redis connections. da001c1
Svante Paldan Further cleanup after code-review. d1bd5a3
@zwant zwant referenced this pull request Mar 1, 2013

Redis leaks connections #6

@didip didip merged commit 171cea4 into didip:master Mar 1, 2013
@zwant zwant deleted the zwant:redis_connection_pool branch Mar 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment