Question
Design a server-side arrival-prediction system for food pickup: when a customer is N minutes from the restaurant, the kitchen should start cooking so food is ready exactly on arrival — too early and it's cold, too late and the customer waits. You track the customer's location as they head to the store and must predict the arrival moment, then trigger 'start cooking now'. Millions of orders/day, customers driving/walking/biking, traffic varies. This is geofencing by predicted time-to-arrival, not a fixed radius. Describe how you model the trigger, why a time-based predictive fence beats a distance ring, how you avoid false triggers, and the trade-off between firing early vs late.
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.