Page MenuHomePhabricator

Agree with stakeholders on the substrate nature, location, and access method
Closed, ResolvedPublic

Description

Stakeholders to consult, at minimum: SRE ServiceOps and Traffic (capacity, ops, cross-DC), MW group for platform concerns (storage APIs lifecycle), and Search Platform (if any search-index coupling is desired in M2). Decision inputs to collect before the conversation: expected entry count (QIDs × languages × revisions), average and p99 entry size, expected read QPS from the eventual consumer set, and a rough write rate from the pre-generation job. Whatever we agree will need to survive for launch load and up to three orders of magnitude higher, but not indefinitely scalable; this should be good-enough, not aspire to be perfect.

Acceptance criteria:

  • A meeting (or written async equivalent) has been held with SRE ServiceOps, Traffic, and the MW platform group, with the decision inputs collected and presented.
  • The expected entry count, average and p99 entry size, expected read QPS, and write rate have been documented as the substrate conversation's starting numbers.
  • The scaling target agreed in that conversation — launch load plus three orders of magnitude headroom, not indefinitely scalable — is recorded alongside the substrate decision.
  • A shortlisted substrate (or a choice from the shortlist) has been endorsed by SRE and whoever else needs to sign off.

Event Timeline

Here is my opening position for review; please push back on any item!

The ask in one paragraph

A single durable key-value table holding pre-generated HTML fragments for Abstract Wikipedia content. Read and write from MW app servers in k8s. At Phase 2 envelope: ~3.9 GiB typical / ~250 GiB worst-case, < 1.7 writes/sec, peak few-dozen reads/sec. Interim lifespan — the store is expected to be re-platformed before Phase 3 rather than scaled to it. Access via a service interface so that re-platforming does not touch callers.

Decision inputs

Phase-by-phase envelope, using ~4 section entries per (QID, locale) + 1 aggregate, and a hard 256 KiB p100 entry cap (p50 ≈ 16 KiB):

phaseQIDslocalessection entriesstorage @ 16 KiB p50worst-case @ 256 KiB capwrite rate (7 d / 30 d sweep)
11 k3~12 k~188 MiB~3 GiB~0.02 / ~0.005 w/s
210 k25~1 M~15 GiB~250 GiB~1.7 / ~0.4 w/s
3 (descoped!)10 M300~12 B~180 TiB~3 PiB~20 k / ~4.6 k w/s

Read QPS: peak few dozen/sec at Phase 1. Varnish in front of MW absorbs reader traffic; the store sees only Varnish cache misses, not normal reader (or logged-in editor) requests.

Scaling target: launch + 3 OOM above launch, not indefinitely scalable. Given Phase 3 is de-scoped, the real commitment is to serve Phase 2 adequately and hand off cleanly.

Blast radius

Reader impact if any component is down: cold-miss UX. A store outage and a cold miss present identically to the reader (both: "not yet available"). The orchestrator is never on the reader path.

Content-freshness impact
  • Store outage: same as cold miss for the outage duration; no regression afterwards.
  • Orchestrator outage: sweep stalls; existing entries keep serving; staleness rises up to the ceiling.
  • Both: same as store outage.
Recommended substrate

MariaDB external store, as a new dedicated table keyed on (qid, section_id, locale, schema_version).

Rationale
  • ~4 GiB typical / ~250 GiB worst-case fits comfortably within external-store conventions.
  • < 2 writes/sec and few-dozen-reads/sec are noise at MariaDB scale.
  • MW has decades of SRE muscle memory for this substrate (backups, failover, restore).
  • No new ops surface for ServiceOps to adopt.
  • Disaster-recovery story is "restore from backup and let the next sweep refill" — worst-case recovery time ≤ one sweep period, comfortably within the staleness ceiling.
Shortlist considered and not chosen
  • Kask — acceptable alternative if SRE would rather not grow MariaDB; operational ergonomics roughly similar, less proven at these access patterns. (open: if SRE prefers Kask, we will take it!)
  • Cassandra — over-specified for this footprint; its multi-DC replication and big-value ergonomics target a load shape we don't have.
  • Swift — only if typical entry size turned out to be hundreds of KiB; not the case here.
  • Pure memcached / mcrouter — excluded; writes must persist between sweeps.
Access method

Callers reach the store only through a FragmentStore service registered in includes/WikiLambdaServices.php, with a minimal interface:

  • FragmentStore::read(key) : ?Fragment
  • FragmentStore::write(key, fragment) : void // rejects oversized
  • FragmentStore::delete(key) : void
  • FragmentStore::enumerateKeys(filter) : iterable<Key>
  • FragmentStore::writeBatch(entries) : void

No caller touches the substrate directly. Substrate replacement before Phase 3 is therefore a service-wiring change, not a caller-by-caller rewrite.

Interim-lifespan framing

This substrate is expected to be re-platformed before Phase 3 enumeration (automatic abstract-article existence sweep) lands. We are not asking for a substrate that scales to 10⁸ entries; we are asking for one that serves Phase 2 reliably and hands off cleanly. SRE sign-off is sought on that basis.

Durability requirement

Writes must persist between sweep cycles (otherwise content disappears without being regenerated before the next sweep). Loss-tolerant caches are excluded. Backup cadence can be generous — the content is re-derivable from the orchestrator — but losing the store and waiting for the next sweep to refill would cost up to one sweep period of reader-visible freshness.

Acceptance criteria ready to tick
  • Meeting held with SRE ServiceOps, Traffic, Data persistence, MW group.
  • Decision inputs documented (table above).
  • Scaling target recorded (Phase 2 commitment; Phase 3 explicitly de-scoped).
  • Shortlisted substrate endorsed by SRE (MariaDB external store is the proposal).
Open items for discussion
  1. Ratify MariaDB external store vs Kask.
  2. Ratify sweep cadence (7 d vs 30 d) — cadence ties into this substrate's write-rate capacity.
  3. Confirm no desired Search Platform coupling.
  4. Confirm cross-DC replication expectation (proposal: replicate as other external stores do; no special treatment).
Jdforrester-WMF changed the task status from Open to In Progress.Apr 16 2026, 7:54 PM
Jdforrester-WMF claimed this task.