Reduce select queries to wiki_revision during kuma.users.views:profile_view

RESOLVED FIXED

Status

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: groovecoder, Assigned: jezdez)

Tracking

({in-triage})

Details

(Reporter)

Description

3 years ago
New Relic reports kuma.wiki.views:profile_view transaction makes an average of 5.81 select queries to wiki_revision, taking an average of 271ms. [1]

We should reduce the number of queries as much as possible; first target 2.5x queries <150ms.

[1] https://rpm.newrelic.com/accounts/263620/applications/3172075/transactions#id=5b225765625472616e73616374696f6e2f46756e6374696f6e2f6b756d612e75736572732e76696577733a70726f66696c655f76696577222c22225d
(Assignee)

Updated

3 years ago
Assignee: nobody → jezdez
Status: NEW → ASSIGNED
Keywords: in-triage

Comment 2

3 years ago
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/f317947a9291fe8e2c542c22937fe06a9dbe5ae4
Fix bug 1179897 - Reduce number of db queries on profile page.

This does a bunch of things:

- Move revision helper to custom user model (ref bug 1180208).
- Use else clause for for loop for getting rid of slow count query.
- Prefetch revision documents to reduce related queries.
- Use a cached property for the previous revision for in-page load caching.

Signed-off-by: Jannis Leidel <jannis@leidel.info>

https://github.com/mozilla/kuma/commit/f07c301c05660a117a5cd91182998019e1854dd5
Merge pull request #3306 from mozilla/bug1179897

Fix bug 1179897 - Reduce number of db queries on profile page.

r=jezdez

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.