The summary of ’20: Distributed Job Scheduler | Systems Design Interview Questions With Ex-Google SWE’

This summary of the video was created by an AI. It might contain some inaccuracies.

00:00:0000:30:29

The video discusses the concept of a distributed job scheduler involving cron and DAG jobs. The speaker emphasizes efficient task scheduling, job dependencies, and managing job statuses. They outline strategies for optimizing the scheduler through error handling, database selection, load balancing, and job retry mechanisms. Mentioned tools include Zookeeper for distributed locking and in-memory message brokers for efficient job allocation. Overall, the video focuses on ensuring job reliability, scalability, and performance within a distributed system.

00:00:00

In this part of the video, the speaker discusses the concept of a distributed job scheduler. They explain that a job scheduler essentially involves running binaries on different nodes according to dependencies, such as in a directed acyclic graph (DAG). The speaker highlights key requirements for the scheduler, including running uploaded binaries upon user request, ensuring jobs run once, providing job status visibility, and supporting both cron jobs and DAGs. The video also delves into task scheduling, specifically focusing on cron task scheduling, where tasks are scheduled based on specified intervals or dependencies. The speaker outlines a process involving two tables for managing cron job settings and scheduled tasks, with an emphasis on efficiency and scalability.

00:05:00

In this segment of the video, the speaker describes the process of scheduling cron jobs and DAG (Directed Acyclic Graph) jobs. They explain that the executive will pull data from the scheduled task table to determine the current job iteration, run the job, update the table for the next iteration, and suggest using a dedicated database table for DAG jobs. The speaker outlines a structure for managing dependencies in the DAG table and explains how to schedule jobs based on dependencies and epochs. They mention the concept of topological sort for determining job dependencies and emphasize the importance of marking epochs for completed tasks. The process involves scheduling root DAG tasks, managing dependencies, and scheduling jobs based on completed dependencies.

00:10:00

In this part of the video, the speaker discusses scheduling tasks related to a job scheduler system. They explain the process of handling errors, updating multiple rows simultaneously using transactions, and the importance of atomicity in data updates. The speaker mentions considering switching from using MySQL to a document-based database for flexibility in representing dependencies. They introduce the scheduler table structure, including job IDs, S3 URLs, run timestamps, and status columns. The speaker emphasizes updating run timestamps to prevent unnecessary retrying of jobs and talks about ensuring fast performance in reading and updating the scheduler table by optimizing data storage methods and index maintenance.

00:15:00

In this part of the video, the speaker discusses optimizing a job scheduler by dealing with contention from locking mechanisms and ensuring load balancing for executots. Two potential solutions suggested are having multiple partitions of the scheduler table or using a read-only replica. To balance load, the video mentions using a load balancer or a message broker for routing messages to the executive nodes efficiently. The use of an in-memory message broker is favored for job scheduling. Additionally, different executors can have varying hardware capabilities, leading to the idea of multiple levels of queues to allocate tasks efficiently based on priorities similar to an operating system’s multi-level priority queue system.

00:20:00

In this segment of the video, the speaker discusses retrying jobs with different timeouts and how to handle job completion and status tracking. They emphasize prioritizing running jobs based on their retry count and marking jobs as completed or failed to avoid endless retries. They suggest adding a status column to the scheduling table to manage job statuses efficiently. The speaker also mentions the importance of minimizing load on the scheduling table by using read replicas for user queries. Additionally, they highlight the use of distributed locks, such as Zookeeper, to prevent running the same job in multiple places simultaneously and avoiding state conflicts.

00:25:00

In this segment of the video, the speaker discusses using Zookeeper to ensure only one job runs at a time by grabbing locks with TTL to prevent issues if an executive goes down. They acknowledge the imperfections due to distributed systems and suggest making jobs idempotent for increased reliability. The speaker also explains their diagram illustrating job scheduling methods, such as queuing jobs and updating job statuses. They emphasize the importance of efficient polling processes and task completion updates for successful job execution.

00:30:00

In this segment of the video, the speaker discusses updating epoch numbers on a DAG table. This update flows through change data capture, Kafka, DAG task queuing node, and back to scheduling node. The speaker ensures this process makes sense and references explanations from previous slides. The segment concludes with the speaker signing off and mentioning upcoming content.

Scroll to Top