GET /xrpc/tech.waow.typeahead.searchActors typeahead.waow.tech

Store and index hold more bytes per account than search needs #50

Open zzstoatzz.io
Open opened by zzstoatzz.io

A slot holds 5.3 GB of store and 5.7 GB of index for 13.27M accounts: about 400 bytes of store and 430 bytes of index per account. tern reports 5.4 GB of store for its whole corpus while keeping far less per account. Disk is what sizes the volumes ($6 a month each) and their snapshots, and the index's size sets how long a restarted slot takes to warm up (issue 48).

where the bytes go #

Not measured per range yet. That is the first step: a count of bytes per key prefix in the store and per stored field in the index, from one slot.

What is known from the layouts:

  • Fields search never returns. The actor record carries description and banner, and the index document stores both again. searchActorsTypeahead returns neither. getProfile and getProfiles return them, and getProfiles took 47,892 requests against 1,190,574 searches over the request log's window (about 4%).
  • Derived keys repeat the DID. h (handle), q (score order), r (refresh due), i (identity due), t (tombstone) and c (change log) each carry the 32-byte DID again, up to six times per account.
  • Seven timestamps and three counts per record, as fixed-width fields.
  • The index stores the whole actor as JSON in one stored field, beside the fields it indexes.

tern keeps handle, display name, avatar CID, an active flag, verification and follower enrichment, in four keyspaces keyed by DID, encoded with postcard, and deletes a deleted account's row.

options, to be weighed after the measurement #

  1. Drop description and banner from the index document and serve getProfile(s) from the store. The index shrinks; the store does not.
  2. Stop storing description and banner at all and have getProfile(s) return the card without them, or fetch them from the account's PDS at request time. This is a change to what the endpoint returns, so it needs the consumers checked first.
  3. Shorter derived keys: a fixed-width account number in place of the DID in q, r, i, t and c.
  4. A compact encoding for the index's stored actor in place of JSON.

Moderation state (labels, overrides, blocked domains) and the change log are what the store exists for and are not candidates.

done when #

The per-range and per-field measurement is in the issue, and each option is either shipped with its before and after sizes or closed with the reason.

Sign up or Sign in to add to the discussion.