23/35
Part 3 of 3 · Serving and driftLearn and do

Fetch features inside the latency budget

Serving adds a limit that training never has: the clock.

The fetch competes with the model for the same milliseconds

Homepage ranking call, p99Interactive
Candidates in15 ms
Feature fetch (3 stores)25 ms
Request-time features10 ms
Ranking model60 ms
Rules and response10 ms
Total120 ms of 150 ms
budget 150 ms
Fits, with 30 ms to spare

Request-time features: 20 µs per item. Ranking model: 120 µs per item.

Lay the ranking call out as stages against the p99 budget, and try the candidate sliders. With 500 candidates the call fits with 30 ms to spare: 15 + 25 + 10 + 60 + 10 = 120 ms. Push both per-candidate stages to 1,000 candidates and they double, to 20 and 120 ms. Now the call takes 190 ms, 40 over.

Anything that depends only on the member should run once per request, not once per candidate. Netflix does this when it builds its foundation model into a ranker. It splits that part of the model off so it runs only once per profile per request, shared by all the items in the request.

In the editor, write call_ms(fixed_ms, per_candidate_us, candidates) and max_candidates(fixed_ms, per_candidate_us, budget_ms). FIXED holds the widget's three fixed stages in milliseconds, and PER its two per-candidate stages in microseconds.