Page MenuHomePhabricator

User::loadFromId() triggers redundant memcached lookups
Closed, ResolvedPublic

Description

User::loadFromId() contains the following check:

if ( $latest || !$this->loadFromCache() ) { /* load from db */ }

If $latest is true, everything is as it should be. If it isn't, then the call to $this->loadFromCache() triggers a memcached lookup, even when user data has already been retrieved from the cache. I have seen over a dozen GETs for the same memcached key in a single request.

Event Timeline

Change 273413 had a related patch set uploaded (by Ori.livneh):
Prevent duplicate memcached lookups for user record

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

Change 273496 had a related patch set uploaded (by Ori.livneh):
Prevent duplicate memcached lookups for user record

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

Change 273413 merged by jenkins-bot:
Prevent duplicate memcached lookups for user record

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

Change 273496 merged by jenkins-bot:
Prevent duplicate memcached lookups for user record

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

ori claimed this task.

Change 274023 had a related patch set uploaded (by Gergő Tisza):
Cache user data in memory

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

Change 274023 merged by jenkins-bot:
Cache user data in memory

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

Change 274040 had a related patch set uploaded (by Ori.livneh):
Cache user data in memory

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

Change 274040 merged by jenkins-bot:
Cache user data in memory

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