v2.0.0
tagged this
07 Feb 16:06
Use TieredCache for ConfigModel caching (2.0.0) ConfigModels have used a Django cache for a long time (memcached in practice), but a major performance issue is that these values are sometimes requested hundreds of times during the course of rendering a request. Memcached roundtrips are fast, but not free, and for some courseware rendering views, memcached access can account for over 20% of the transaction time. The TieredCache from edx-django-utils uses a request-level cache and Django cache in combination so that it will only reach out to memcached once for a given config value in a given request. This commit also introduces other notable changes: * Version has been bumped to 2.0.0 * Python 2.7 support has been dropped * edx-django-utils is now a dependency (for TieredCache) * Django projects using this package must now configure RequestCache middleware: https://github.com/edx/edx-django-utils/tree/master/edx_django_utils/cache#tieredcachemiddleware * Tests have been updated to use CacheIsolationTestCase rather than mocking out the cache. This simplifies the tests somewhat, and reduces test reliance on the implementation details of caching. We still verify that caching happens by database query count. * We no longer use a dedicated configuration cache setting. The original idea was that we could have something that was on a different lifecycle (e.g. process-level). But in practice we always used the same cache cluster as the default anyway, and using TieredCache gives us most of the benefit of not having to make so many calls out. This change lets us remove one more configuration setting.