You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you would use a single connection for django.core.cache.cache operations.
You would actually use pooling, only if you interact with the Connection Pool manually by requesting connections.
Intended behavior
If we configure django_redis as mentioned in docs, we expect it to use multiple connections to the redis. This would be especially required in the concurrent world.
If connection doesn't exist, get_client would call connect on connection_factory available through ConnectionPool to get a connection from the pool. Otherwise it reuses last created connection for that server.
I think pooling behaviour would be correct in Django's official implementation but Django's Redis backend may not be mature enough yet.
EDIT: Hm, I was wrong, it seems like pooling is handled at redis.client.Redis level. So, the implementation logic is same as Django's Redis backend. django_redis's implementation is correct!! I'll dig why connection pooling isn't working properly in my case.
The text was updated successfully, but these errors were encountered:
Description
I found that connection pooling doesn't work in
django-redis
package as intended if you use it as Cache Backend in Django.Even if you configure it like -
you would use a single connection for
django.core.cache.cache
operations.You would actually use pooling, only if you interact with the Connection Pool manually by requesting connections.
Intended behavior
If we configure django_redis as mentioned in docs, we expect it to use multiple connections to the redis. This would be especially required in the concurrent world.
Stack trace
Here's code references -
get_client
to get low level redis clientget_client
maintains list of redis connections, one for each mentioned server.get_client
would callconnect
onconnection_factory
available throughConnectionPool
to get a connection from the pool. Otherwise it reuses last created connection for that server.I think pooling behaviour would be correct in Django's official implementation but Django's Redis backend may not be mature enough yet.EDIT: Hm, I was wrong, it seems like pooling is handled at
redis.client.Redis
level. So, the implementation logic is same as Django's Redis backend.django_redis
's implementation is correct!! I'll dig why connection pooling isn't working properly in my case.The text was updated successfully, but these errors were encountered: