POST /api/v1/user-events{user_id, event_type, product_id, timestamp}GET /api/v1/recommendations/home?user_id=...POST /api/v1/feedback[Client/App] ──▶ [API Gateway]
│
▼
[Kafka / PubSub]
│
┌──────────┼────────────┐
▼ ▼
[ClickStream Processor] [Batch Processor]
(Flink/Spark) (Spark)
│ │
▼ ▼
[Feature Store] [Offline Model Training]
│ │
▼ ▼
[Online Ranker Service] ◀──── [Trained Models]
│
▼
[Recommendation API] ──▶ [Client]
viewed_product, add_to_cart eventsFlink Processor
Feature Store
Model Inference (Online)
| AreaChoiceProsCons | |||
| Stream Processing | Flink | Stateful ops, checkpointing | Complex to manage |
| Storage | Redis + S3 + PostgreSQL | Balanced: fast + durable | Multi-tier design complexity |
| Feature Serving | Redis / DynamoDB | Low-latency | Limited query flexibility |
| Model Framework | PyTorch / TensorFlow + Faiss | Flexible, production-ready | Need inference infra tuning |
| Batch Engine | Spark | Mature ecosystem | Costly on large-scale clusters |
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?