Design the online keys around the request, not the feature
The online store's keys decide how many reads each ranking call makes.
| Feature kind | Values per request | Where it lives | Reads per request |
|---|---|---|---|
| Member | 1 set | the online store, under the member's key | 1 |
| Title | 500 sets, the same for every member | each server's memory | 0 |
| Member-by-title | 500 values | inside the member's value, as a map from title to value | 0 more |
A member-by-title feature describes one member and one title together, like how often this member saw this title today.
Naively, the ranker reads 1 member key and 500 title keys per request. At 20,000 requests a second, that's 20,000 × 501, about 10 million reads per second. Two changes fix that.
Title features are shared by every member. At 60 features plus a 64-number embedding, a title is about 500 bytes. So the whole 20,000-title catalog is about 10 MB. Keep it in each server's memory and refresh it every few minutes. Title reads drop to zero.
Member-by-title features go in one value per member. Impressions of each title today become a map from title to count, under the member's key. That's one read per request instead of 500.
That leaves about 20,000 member reads per second per store, a 500-fold cut.
In the editor, write reads_per_second(rps, candidates, titles_in_memory) and catalog_mb(titles, features, dims). The last lines count the reads both ways at 20,000 requests a second, and size the 20,000-title catalog.