Part I: Foundations of Distributed AI
Chapter 2: Distributed Systems Concepts for AI

Distributed Systems Concepts for AI

The coordination, partitioning, replication, consistency, and recovery machinery the six axes run on, each introduced through the AI operation that uses it.

Conceptual illustration for Chapter 2: Distributed Systems Concepts for AI

"I sent my gradient three milliseconds ago. The coordinator has not acknowledged it, two of my peers have crashed, and somebody just told me the parameters I read are already stale. This is, apparently, the normal case."

A Worker That Lost Its Coordinator

Chapter Overview

Distributed systems is an old and deep field, and a graduate text could spend a year on consensus alone. This chapter does something narrower and more useful for an AI audience: it isolates the handful of concepts that distributed AI actually exercises and presents each one through a training or serving operation you will meet again. The framing throughout is the tension Chapter 1 introduced. Every machine you add buys capacity, and every machine you add must communicate with the others and can fail independently of them. The concepts here are the named tools for buying that capacity while keeping the two taxes, communication and failure, under control.

A word on scope. This chapter borrows freely from classical distributed systems, but it scopes every borrowed idea to what AI actually uses. Synchronous training leans hard on collectives and barely touches general consensus; the control plane is the opposite. Where AI uses less of a primitive than a database or an HPC code would, the text says so plainly. The goal is not to teach distributed systems in full; it is to give you exactly the vocabulary the parallel-training and serving chapters assume on every page.

Prerequisites

This chapter assumes you have read Chapter 1: What Is Scale-Out AI? and carry its vocabulary with you: the six axes of distribution, the scale-out versus scale-up distinction, the coordinator-to-no-coordinator architecture spectrum, and the four operational metrics of throughput, latency, cost, and reliability. The systems concepts here are the machinery those axes run on, so the axes are the map and this chapter is the toolbox. No prior distributed-systems coursework is needed; every primitive is built from first principles as the AI operation that uses it introduces it. The Python, machine-learning, probability, and linear-algebra background the book takes for granted, refreshed in Appendix A: Mathematical Background, remains sufficient.

Learning Objectives

Chapter Roadmap

What's Next?

This chapter gave you the qualitative machinery of distributed systems: roles, communication, partitioning, recovery, consistency, consensus, stragglers, locality, and the patterns that combine them. Chapter 3: Scalability and Performance Models makes that machinery quantitative. The straggler you met in Section 2.7 becomes a term in a throughput equation; the communication of Section 2.2 becomes a cost you can predict before you run; and the question Chapter 1 first posed, when does adding a machine actually help, becomes a calculation through Amdahl's law, Gustafson's law, and the speedup and efficiency models of a distributed job. Read it next, and the trade-offs this chapter described in words will become numbers you can put a budget against.

Bibliography & Further Reading

Foundational Papers

Dean, J., Ghemawat, S. "MapReduce: Simplified Data Processing on Large Clusters." OSDI 2004. research.google

The master-worker pattern of Section 2.9 in its most influential form; its handling of stragglers and worker failure is the template for fault-tolerant batch computation.

📄 Paper

Zaharia, M., Chowdhury, M., Das, T., et al. "Resilient Distributed Datasets: A Fault-Tolerant Abstraction for In-Memory Cluster Computing." NSDI 2012. usenix.org

The RDD lineage idea recovers lost partitions by recomputation rather than replication; a concrete answer to the fault-tolerance question of Section 2.4.

📄 Paper

Dean, J., Barroso, L. A. "The Tail at Scale." Communications of the ACM 56(2), 2013. cacm.acm.org

The definitive account of why the slowest component dominates latency at scale and how to mitigate it, the systems grounding for the straggler treatment of Section 2.7.

📄 Paper

Li, M., Andersen, D. G., Park, J. W., et al. "Scaling Distributed Machine Learning with the Parameter Server." OSDI 2014. usenix.org

The canonical parameter-server design and its bounded-staleness consistency model, the live example behind both Section 2.5 and the pattern catalog of Section 2.9.

📄 Paper

Consensus & Consistency

Lamport, L. "Paxos Made Simple." ACM SIGACT News 32(4), 2001. lamport.azurewebsites.net

The foundational algorithm for agreement under failures; the theory behind the control-plane consensus that Section 2.6 isolates from the training data plane.

📄 Paper

Ongaro, D., Ousterhout, J. "In Search of an Understandable Consensus Algorithm (Raft)." USENIX ATC 2014. raft.github.io

The understandable consensus algorithm that powers etcd and most modern control planes; the leader election of Section 2.6 in practical form.

📄 Paper

Brewer, E. "CAP Twelve Years Later: How the Rules Have Changed." IEEE Computer 45(2), 2012. infoq.com

The author of the CAP theorem revisits the consistency-versus-availability trade; the precise framing Section 2.5 uses for serving systems under partition.

📄 Paper

Vogels, W. "Eventually Consistent." Communications of the ACM 52(1), 2009. cacm.acm.org

The practitioner's case for weak consistency in large systems; the intuition for why staleness-tolerant parameter reads in Section 2.5 are a feature, not a bug.

📄 Paper

Books & Surveys

Kleppmann, M. "Designing Data-Intensive Applications." O'Reilly, 2017. dataintensive.net

The standard practitioner text on partitioning, replication, and consistency; the systems foundation this chapter specializes toward AI training and serving.

📖 Book

Dean, J. "Designs, Lessons and Advice from Building Large Distributed Systems." LADIS 2009 keynote. research.google

The back-of-the-envelope latency and failure-rate numbers that make "failure is the normal case" a quantitative claim, the grounding for Section 2.4.

📝 Talk

Tools & Libraries

etcd Documentation: a distributed, reliable key-value store. etcd.io/docs

The Raft-backed key-value store that holds the control-plane state of Kubernetes and many ML schedulers; the consensus of Section 2.6 as a service you call.

🔧 Tool

Apache ZooKeeper Documentation. zookeeper.apache.org

The coordination service for leader election, configuration, and distributed locks; the classic realization of the control-plane coordination Section 2.6 describes.

🔧 Tool

PyTorch Distributed: torch.distributed collectives and DistributedDataParallel. pytorch.org/docs

The collective and process-group APIs that implement the all-reduce and barrier primitives of Section 2.2 without a coordinator; the toolkit Part IV builds on.

🔧 Tool