AlgoViz

Requirements of a task scheduler

medium 26 min

A task scheduler runs work later, in the right order, on many machines, and does not forget it.

Remember it

The few things worth knowing cold, and how to make them stick.

Memory hook

TASKS: Throughput, Availability, Scalability, Kinetics, Safety.

Planning chores on a farm: write it down, say when, what goes first, who takes over, was it done already, how much work.

Cheat sheet

Accepted
stored, then answered
Runs
at least once
Submit p99
200 ms
Start p99
5 s
Availability
99.99%, 52.6 min a year
Busy slots
rate x duration
Retry
1, 2, 4, 8 s, capped, with jitter
Give up
dead letter and alert

Spot it when you see

  • Work that can finish after the answer.
  • Anything at a later time or every night.
  • Retries over minutes or days.

Tricks that stick

  • T is for Throughput: tasks a second from your traffic.
  • A is for Availability: submits succeed.
  • S is for Scalability: add workers.
  • K is for Kinetics: latency of submit and start.
  • S is for Safety: nothing accepted is lost.
  • Submit, queue, execute, retry if needed, complete.

Do not forget

  • Promising exactly-once running.
  • A percentage for durability.
  • No timeout.
  • Large payloads inside tasks.
  • Forgetting the spike on the full hour.