Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit connection pool size #54

Closed
yuvadm opened this issue Aug 17, 2013 · 3 comments
Closed

Limit connection pool size #54

yuvadm opened this issue Aug 17, 2013 · 3 comments

Comments

@yuvadm
Copy link

yuvadm commented Aug 17, 2013

There should be a way to limit size of Redis connection pool with the redis-py max_connections parameter.

Deployments with hard limits on number of connections (i.e. using third-party Redis services) fail when connections are dropped due to these limits.

@sebleier
Copy link
Owner

I'll add something in this week.

@dlitwak
Copy link

dlitwak commented Feb 19, 2014

Has there been any update on this front?

@sebleier
Copy link
Owner

@dlitwak Thanks for reminding me. I've updated the cache backend (and is available on PyPI) so you can specify a connection pool class and the kwargs to initialize it.

For example:

CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '<host>:<port>',
            'OPTIONS': {
                'DB': 1,
                'PASSWORD': 'yadayada',
                'PARSER_CLASS': 'redis.connection.HiredisParser',
                'CONNECTION_POOL_CLASS': 'redis.BlockingConnectionPool',
                'CONNECTION_POOL_CLASS_KWARGS': {
                    'max_connections': 50,
                    'timeout': 20,
                }
            },
        },
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants