Requirements of a Task Scheduler 00:00:01 Promise a reminder for nine o'clock A clinic wants appointment reminders delivered near nine. Before choosing a queue, define what accepting a task promises, when a task becomes eligible, how late it may start and how an operator can tell what happened. The client sends payload, priority and time. The task is written to durable storage with a copy. The handler runs under a timeout. After a failure the task waits and is queued again. Distinguish scheduled time, actual start and successful completion. A message delivered near the appointment can still be useless if its handler spends the next hour blocked. 00:00:39 The clinic loses its submission receipt The clinic presses submit and the network disappears after durable storage succeeds. Retrying with a new identity could remind the same patient twice. Preserve a client-chosen operation key across that uncertainty. The client sends key order-42. The task is saved. The connection breaks. Same key. The store finds t1 and creates nothing. Store the key, request identity and resulting task together. Reusing the key with a different intended operation should have a documented response. Define how long the deduplication record must remain. 00:01:18 A worker disappears mid-reminder A worker claims a reminder until a specified time and then vanishes. A later worker must be allowed to make progress. The earlier worker might also wake up and try to report success. Worker 1 takes t1 until second 30. This is attempt 1. No heartbeat arrives. Nothing happens yet. Attempt 2, with a new lease. It reports attempt 1. The current attempt is 2, so the report is ignored. Changing an attempt token can reject a stale completion record. Preventing a second real-world email requires an idempotent delivery boundary or reconciliation with the sending provider. 00:01:58 Decide when a reminder is too late Transient delivery errors deserve a bounded retry. A permanently invalid address or obsolete appointment needs a different ending. Record each attempt and keep enough context for the clinic to resolve the failure. The mail service answers 503. It may pass. Still 503. The delay doubles. Again. A random point inside the delay keeps tasks apart. Three retries are used up. The task goes to the dead-letter queue and a person is told. Choose retry deadlines against the usefulness of the task as well as its technical success rate. A message saying “arrive in ten minutes” should have an explicit expiry. 00:02:41 A million reminders share the same minute Average daily volume hides a scheduled spike. A million tasks due inside five seconds require two hundred thousand starts per second. Spreading the work only helps if the clinic accepts that scheduling window. Everything is calm. The tasks are stored and waiting. Starting all in 5 seconds means 200,000 a second. 858 slots cannot do that. Each reminder gets a random minute from 09:00 to 09:10: 1,667 a second. At 2 seconds each this needs about 3,300 slots for ten minutes, so add workers before 09:00. The time is known, so this is planned and not a surprise. Translate starts per second into occupied worker slots using handling time. Then add headroom and specify the acceptable start delay, duplicate policy and failure experience alongside the capacity estimate.