Page MenuHomePhabricator

CachingPropertyInfoLookup doesn't cache lookups internally
Closed, ResolvedPublic

Description

(Found via auditing the performance)

In rendering a page in client that uses Wikidata with lua, there's 1823 calls to memcached from Wikibase\Lib\Store\CachingPropertyInfoLookup::getPropertyInfoFromWANCache. This means every time it needs a property info, it makes a call over network to mcrouter/memcached. The client page definitely doesn't use 1832 different properties of Wikidata. This can be a great performance boost by keeping the loaded properties as a class attribute and short circuit lookups.

Event Timeline

Addshore moved this task from Incoming to Needs Tech Work on the Wikidata-Campsite board.

At one point we did also cache this for ~10-20s on machines.
I both added and removed that last year.
It was removed in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/498348/18/repo/includes/Store/Sql/SqlStore.php

However that was to get around fetching the large amount of data (as the whole table is fetched) rather than stopping multiple calls.

I see in that profile it says "WANObjectCache::fetchOrRegenerate 2059 calls" How many of them are for the property info?
We should definitely do something about this.

I guess our two options are wrap in another local cache as in the gerrit patch linked above.
Or use the process cache functionality built into the WAN cache.
Thoughts?

At one point we did also cache this for ~10-20s on machines.
I both added and removed that last year.
It was removed in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/498348/18/repo/includes/Store/Sql/SqlStore.php

However that was to get around fetching the large amount of data (as the whole table is fetched) rather than stopping multiple calls.

I see in that profile it says "WANObjectCache::fetchOrRegenerate 2059 calls" How many of them are for the property info?

1823 of them: https://performance.wikimedia.org/xhgui/run/symbol?id=5e31d1ba3f3dfab22d4d158a&symbol=Wikibase%5CLib%5CStore%5CCachingPropertyInfoLookup%3A%3AgetPropertyInfoFromWANCache

Change 570100 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Cache PropertyInfoLookup internally

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

Change 570100 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Cache PropertyInfoLookup internally

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

Change 570300 had a related patch set uploaded (by Ladsgroup; owner: Addshore):
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.16] Cache PropertyInfoLookup internally

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

Change 570301 had a related patch set uploaded (by Ladsgroup; owner: Addshore):
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.18] Cache PropertyInfoLookup internally

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

Change 570300 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.16] Cache PropertyInfoLookup internally

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

Change 570301 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.18] Cache PropertyInfoLookup internally

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

Mentioned in SAL (#wikimedia-operations) [2020-02-05T13:15:02Z] <ladsgroup@deploy1001> Synchronized php-1.35.0-wmf.16/extensions/Wikibase/lib/includes/Store/CachingPropertyInfoLookup.php: SWAT: [[gerrit:570301|Cache PropertyInfoLookup internally]] (T243955) (duration: 01m 07s)

Mentioned in SAL (#wikimedia-operations) [2020-02-05T13:24:46Z] <ladsgroup@deploy1001> Synchronized php-1.35.0-wmf.18/extensions/Wikibase/lib/includes/Store/CachingPropertyInfoLookup.php: SWAT: [[gerrit:570301|Cache PropertyInfoLookup internally]] (T243955) (duration: 01m 07s)