Index

Module 07 · From ScratchDistributed Scheduler

Scheduler 07: The Hard Part - Time

The Hard Part - Time
The Hard Part - Time · Open board

From Scratch · Distributed Scheduler.

Before you start. This lesson is part of a build that makes a small distributed job scheduler - a program that fires jobs at the right moment, on the right machine, even when a machine crashes mid-run. Six earlier stages already gave it a lot. It can tell which job is due next without scanning the whole list. It survives a crash, because every job lives in a database instead of only in memory. Several machines run the scheduler, but only one of them, the leader, decides which jobs fire. It stays leader by holding a lease, a permission that runs out unless it keeps renewing it. The leader does not run the jobs itself. It drops each one into a queue, a waiting line that other machines take work from. And every new lease comes with a bigger number, so the database can refuse a write from an old leader that has not noticed it was replaced. All five of those were built on one thing nobody checked: that the clock telling them the time is telling the truth.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Related paper

Review From Scratch →

Saved in this browser, and to your account when you sign in.