Graphs show us that PrefetchingPropertyTermLookup::prefetchTerms() is being called around 70K times every minute. This is clearly too much for something like properties. I suggest adding a layer of APCu cache with TTL of ten seconds to keep the hot data in the servers for long period of time without drowning it.
Description
Details
Related Objects
Event Timeline
As noted in mattermost this might relate to T241050 and before we add any cache we should make sure we need to.
What exactly is causing all of these calls to prefetchTerms ?
To check next: why prefetching happens, and whether it is needed - if not, should stop happening.
We dove a bit deeper into all of the things that are happening surrounding the prefetching, term buffers, lookups, fallbacks and caching and decided that to do this properly we should probably aim for something like this:
This doesnt really account for just wanting to retrieve raw terms (rarther than term fallbacks yet), but that could also be worked in, even with its own cache.
This topic area might be a good candidate for a Wikidata-Trailblazing-Exploration
Change 566779 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Add TermCache
Change 567020 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Add LatestRevisionResolvingTermCache
Change 567487 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Add CachingPrefetchingTermLookup
Change 566779 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add TermCacheKeyBuilder
Change 568494 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] LatestRevisionAndRedirectResolverTest: avoid repeated lookups
Change 569210 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Wire up caching around PrefetchingPropertyTermLookup
Change 567020 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add RedirectResolvingLatestRevisionLookup
Change 567487 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add CachingPrefetchingTermLookup
Change 568494 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] LatestRevisionAndRedirectResolverTest: avoid repeated lookups
Change 569210 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Wire up caching around PrefetchingPropertyTermLookup
Change 571964 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Wrap PrefetchingPropertyTermLookup cache to emit metrics
Change 571964 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Wrap PrefetchingPropertyTermLookup cache to emit metrics
So I noticed that this change can now be seen in some other metrics now too (once I finally narrowed 12th 13th 14th of feb 2020 down to 1.35.0-wmf.19 and finally this ticket and these commits.
Below is the grafana dashboard showing the time it takes to generate parser output for Wikibase items.
At the time this change was deploy we saw median "parse" time (and also p75 parse time) for Wikibase item halfed (~200ms -> ~100ms)
(which is awesome)