ubyssey / ubyssey.ca

The code that powers www.ubyssey.ca
GNU General Public License v2.0
36 stars 41 forks source link

Configure site to use a real cache backend #1332

Closed psiemens closed 10 months ago

psiemens commented 10 months ago

The production settings file currently specifies the DummyCache backend, which implements the Django caching interface but doesn't actually cache anything. This overrides the default local memory cache, which Django uses if no backend is specified.

I believe this has the (potentially unintended) side effect of disabling Django's built-in caching behaviour, most notably template caching, which is known to greatly speed up sites.

We should look into bringing back a functional cache, even if it's just a local memory cache for now. Something like Redis that works across instances would be better in the long run.

psiemens commented 10 months ago

Quick benchmark: the homepage makes 640 database queries with the dummy cache enabled but only 503 queries when using the local memory cache.

psiemens commented 10 months ago

I'm reopening this to track our progress moving from the built-in local memory cache to a persistent solution.

Wagtail and Google both recommend Redis. We previously used the Memcache service that was bundled with App Engine, but Google is now recommending that Python 3 apps migrate to Memorystore (which supports Redis). I think that's worth trying.