Page MenuHomePhabricator

Do not use count(*) for reading list size limits
Closed, ResolvedPublic

Description

Reading list size limits are enforced by doing a count(*) before every insert, which is problematic performance-wise. Per discussion with @jcrespo the best alternative would be to keep track of list sizes in a separate field, ie. add reading_lists.rl_size, make sure it's incremented on insert and decremented on delete, backfill in production, and replace count(*) checks with reading that field.

We don't do the same for list number limit checks as the limit there is 100 lists per user, and the suggested upper limit for number of rows a query should touch is something like 1000.

Details

Related Gerrit Patches:
mediawiki/extensions/ReadingLists : wmf/1.31.0-wmf.23Track reading list size
mediawiki/extensions/ReadingLists : masterTrack reading list size

Event Timeline

Tgr created this task.Feb 13 2018, 7:02 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 13 2018, 7:02 PM
Tgr claimed this task.Feb 13 2018, 8:35 PM
Tgr moved this task from To Do to Doing on the Product-Infrastructure-Team-Backlog (Kanban) board.
Tgr added a comment.Feb 16 2018, 2:50 AM

Given that all wikis share the same DB and after the patch rl_size needs to be updated to work correctly, it will have to be deployed to all wikis at the same time via SWAT. (Or I guess we could just ignore the buggy behavior given that RL is still in test mode...)

Change 410653 merged by jenkins-bot:
[mediawiki/extensions/ReadingLists@master] Track reading list size

https://gerrit.wikimedia.org/r/410653

Tgr added a comment.EditedMar 5 2018, 11:06 PM

Deployment plan:

Change 416610 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/ReadingLists@wmf/1.31.0-wmf.23] Track reading list size

https://gerrit.wikimedia.org/r/416610

Change 416610 merged by jenkins-bot:
[mediawiki/extensions/ReadingLists@wmf/1.31.0-wmf.23] Track reading list size

https://gerrit.wikimedia.org/r/416610

Mentioned in SAL (#wikimedia-operations) [2018-03-06T01:48:24Z] <tgr@tin> Started scap: T187226#4025352 update ReadingLists

Mentioned in SAL (#wikimedia-operations) [2018-03-06T02:07:14Z] <tgr@tin> Finished scap: T187226#4025352 update ReadingLists (duration: 18m 49s)

Tgr closed this task as Resolved.Mar 10 2018, 12:55 AM