Closed Bug 1277994 Opened 8 years ago Closed 8 years ago

Make hot-path APIs fast

Categories

(Firefox :: Normandy Server, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: mythmon, Assigned: mythmon)

References

Details

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
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Product: Shield → Firefox
You need to log in before you can comment on or make changes to this bug.