Skip to content

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

Open
@oOoBlackHoleSunoOo

Description

@oOoBlackHoleSunoOo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions