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

Does make Pooling sense for small apps/sites? #629

Open
oOoBlackHoleSunoOo opened this issue Nov 8, 2022 · 0 comments
Open

Does make Pooling sense for small apps/sites? #629

oOoBlackHoleSunoOo opened this issue Nov 8, 2022 · 0 comments
Labels

Comments

@oOoBlackHoleSunoOo
Copy link

Hello,
i am implementing django-redis in my django 3.2.16 website. I do not use the session backend but i cache, specific, bigger queries from my postgreSQL database and some GEOjson data. So far it works "blazingly fast" in my development setup.

1.) my question is:
Does make the pooling option sense for a small website?

For instance i am currently have this option

    CACHES = {
        "default": {
            "BACKEND": "django_redis.cache.RedisCache",
            "LOCATION": "redis://<redis-or-docker-ip>:<port>/<redis-db-number>",
            "OPTIONS": {
                "CLIENT_CLASS": "django_redis.client.HerdClient", # set herd Class
                "PASSWORD": "password-here",
                "CONNECTION_POOL_KWARGS": {"max_connections": 10, "retry_on_timeout": True}                
            },
        }
    }

My production django site is served by uwsgi with up to max 3 workers and each worker can have 2 threads. However the views and django app is still synchronous. So if each worker initialize a new Django instance it would mean 30 redis connections? Yet each worker probably only uses 1 redis connection?

2.) my question is:
Set key in pooling via client or cache?

In the moment is set new keys and values via cache.set() do i have to use get_redis_connection("default").set() if i use Pooling?

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

No branches or pull requests

1 participant