Page MenuHomePhabricator

Add instrumentation and benchmarks for ReadingLists bloom filter lookups
Closed, ResolvedPublic3 Estimated Story Points

Description

Summary

It would be useful to have some metrics about how well (or not) that the bloom filter is working in ReadingLists.

  • How fast is the memcached lookup to retrieve the bloom filter? (with cache hit)
    • bloom filter with negative result (page definitely not bookmarked)
    • bloom filter with false positive or saved page, with the subsequent DB query to verify and retrieve metadata
  • How fast is the saved page lookup via DB query? (for cases that bypass bloom filter)
  • How fast is the query to retrieve the saved pages and build the bloom filter? and overall building the bloom filter
  • How quickly are the bloom filter rebuild jobs processed? (from time the jobs are enqueued and run)
  • How often there is bookmark status lookup, which results in cache status missing vs stale?

Things to measure:

  • latency
  • cache payload size
  • DB query count (number of saved pages)

Other questions:

  • How often do the lookups hit a cached bloom filter? (cache hit/miss rate)
  • How often does the bloom filter produce a definite negative and avoid the DB lookup?
  • How often does it produce a probable positive, thus requiring the DB lookup?
  • How often are there false positives?
  • How often are bloom filter rebuilds triggered?
  • How often is the bloom filter bypassed because the user has more than the configured max number of pages?

For the metrics, we should use statslib that is available in MediaWiki:

and see example https://gerrit.wikimedia.org/g/mediawiki/extensions/DiscussionTools/+/4d8f74e8876e95dd5ee3802ff5fecd531b17b97b/includes/CommentFormatter.php#77

Follow up:

  • Create a Grafana dashboard for these metrics and maybe for ReadingLists in general

Technical notes

This can be done in multiple patches:

Use counters for:

  • cache miss
  • definite negative
  • probable positive
    • false positive
    • true positive
  • user has too many pages saved, bypassing bloom filter
  • bloom filter rebuild

Use timers:

  • cache lookup latency
  • DB lookup latency
  • rebuild latency

Developer setup

Setup with docker (see above) and use the following settings:

$wgStatsdServer = 'statsd';  // might not be needed
$wgStatsTarget = 'udp://statsd-exporter:9125';
$wgStatsFormat = 'dogstatsd';

To view the stats events:

curl -s http://localhost:9112/metrics | grep -E 'readinglists'

Event Timeline

aude set the point value for this task to 5.Apr 1 2026, 4:10 PM
aude triaged this task as High priority.Apr 1 2026, 4:12 PM
aude moved this task from Incoming to Ready for sprint on the Reader Experience Team board.
aude lowered the priority of this task from High to Medium.Apr 7 2026, 6:19 PM

Change #1270063 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Add bloom filter lookup and db stats counters

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

I created separate tasks for the instrumentation of the rebuild job, as well as timings and payload size:

aude updated the task description. (Show Details)

Will need to carry over to next sprint as it's been a challenge to get code review support.

AnneT changed the point value for this task from 5 to 3.Apr 27 2026, 5:27 PM
AnneT subscribed.

Re-estimating for just code review

Change #1270063 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Add bloom filter lookup and db stats counters

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