Skip to content

PATTERN Cited by 1 source

Proactive cache of daily batch predictions

Problem

A B2B recommendation / optimisation product has two access shapes:

  • Most of the time, a partner opens their dashboard and wants to see the latest recommendation. No parameter changes — just "show me what you've got."
  • Occasionally, a partner changes a parameter and wants to see the re-scored recommendation on the fly.

If every dashboard load triggered a live optimisation pass, you'd pay compute for reads that have no fresh state to consider. If you only computed recommendations on demand, latency would be bad for the 95% case.

Pattern

Precompute and cache recommendations for all entities via a daily batch job; serve reads from the cache; reserve on-demand compute for the minority case where parameters actually change.

  1. Daily batchSageMaker Batch Transform (or equivalent) runs the optimiser across all entities using the latest known settings from the offline feature store.
  2. Cache population — batch output written to a durable store (S3, KV); a "report generated" notification fires for interested consumers.
  3. Serving reads — dashboard fetches precomputed results from the cache; no on-demand compute.
  4. On-demand fallback — only user-initiated parameter changes fire an online recomputation path (see patterns/async-sqs-lambda-for-interactive-optimisation).
  5. Write-back for consistency — user parameter changes are persisted back to the offline feature store so the next daily batch picks them up (see patterns/online-plus-offline-feature-store-parity).

Why daily cadence works

  • B2B inventory decisions don't need intra-day freshness for the majority case. Daily-latest is acceptable for replenishment recommendations.
  • Batch compute is cheap. SageMaker Batch Transform on a nightly run has 10× better $/prediction than online compute.
  • Operational predictability. Batch wall-clock is measurable; any regressions (data drift, cost spike, lost data) show up on the next day's run.

Canonical instance (Zalando ZEOS)

Zalando ZEOS's replenishment recommender runs a daily batch across all merchants × all articles:

"Once these settings are established, we proactively cache both the settings and the resulting recommendations on a daily basis. This ensures that our offline batch process consistently delivers up-to-date, dynamic recommendations, taking into account the latest inputs, forecasts, and stock states."

"The offline (batch) engine generates daily recommendation reports using finalised inputs from offline feature stores."

Seen in

Last updated · 501 distilled / 1,218 read