Status

()

Firefox
Normandy Server
P2
normal
RESOLVED FIXED
2 years ago
3 months ago

People

(Reporter: mythmon, Assigned: mythmon)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

2 years ago
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.
(Assignee)

Comment 1

2 years ago
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)

Updated

2 years ago
Assignee: nobody → mcooper
Status: NEW → ASSIGNED

Updated

2 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED

Updated

3 months ago
Product: Shield → Firefox
You need to log in before you can comment on or make changes to this bug.