In v8 of Normandy (what is currently deployed), we optimize the "hot-path" views (the ones that each get hit about ~5 times/second). This is done by making sure that none of these views make DB queries (when the cache is hot). There are tests that verify this. The new hot-path doesn't use the optimized views, and goes through a couple DRF views. We can cache these in a similar way so that they don't make DB queries. We should add tests to verify this. This bug covers: 1) Figure out what the hot path is now 2) Add tests that assert the hot path doesn't make any DB calls with a hot cache 3) Make the tests pass For reference, here is a test that asserts a view doesn't make any DB queries: https://github.com/mozilla/normandy/blob/04f61576d14b55bcbc7a8a5e12a7a8ec6656fcc8/normandy/recipes/tests/test_api.py#L335-L351 And here is the part that doesn't hit the DB: https://github.com/mozilla/normandy/blob/04f61576d14b55bcbc7a8a5e12a7a8ec6656fcc8/normandy/recipes/models.py#L354-L357 This is required before we can deploy again.
I'm changing the subject of this bug because we may implement this differently. It isn't important that the views make no DB hits, or that there are tests that enforce this. It is important that the views are fast enough to be used in production. Another way we might do this is setting cache headers and let Nginx do the caching for us.
Summary: Add database caching to hot-path APIs → Make hot-path APIs fast
Assignee: nobody → mcooper
Status: NEW → ASSIGNED
Commit pushed to master at https://github.com/mozilla/normandy https://github.com/mozilla/normandy/commit/38110cadcd17ed7618ed2ad2784169ac7ae36258 Add cache headers to "hot-path" APIs Fixes bug 1277994.
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.