Adding CacheMiddleware configs slowed down on-premise installation!

Without giving away too much information, comparing an instance that has the default MIDDLEWARE_CLASSES list and the modified list with UpdateCacheMiddleware and FetchFromCacheMiddleware and a cache time of 2400ms slowed down the page loads by quite a bit. Did anyone else also see the same effect?

This is the config I tried out with:

def insert_cache_middleware(existing_middlewares):
        common_middleware_idx = existing_middlewares.index('django.middleware.common.CommonMiddleware')
        return (
            + ('django.middleware.cache.UpdateCacheMiddleware',)
            + (existing_middlewares[common_middleware_idx],)
            + ('django.middleware.cache.FetchFromCacheMiddleware',)
            + existing_middlewares[common_middleware_idx+1:]
    except ValueError:

    return existing_middlewares


Rusty Python, but the settings are working. Just that this has a pretty negative impact on pretty much most of the async calls that are made from the dashboard.

Do we recommend doing this somewhere? I would not do this.

Ah, thanks! No, there’s nothing in the docs. I was going through Django docs and tried it out.