Leanpub Header

Skip to main content

The Distributed Systems Handbook

Design, Implement, and Operate Production-Grade Systems Using Modern Engineering Practices

This book is 100% completeLast updated on 2026-08-01

Distributed systems can feel overwhelming until you build one yourself. This book takes you from core networking and concurrency concepts to a complete production-ready platform in Go. Every chapter adds real working code so you learn not just the theory but how reliable systems are built and run at scale.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
333
Pages
About

About

About the Book

This book teaches you how to build distributed systems from first principles. Starting with fundamental concepts of networking, concurrency, and fault tolerance, we progressively construct a complete distributed platform using Go. Each chapter extends the previous one into a working system, with production-ready code that compiles and runs without omissions or placeholders. By the end, you will understand not only how distributed systems work but why they are built the way they are, and you will have the practical skills to design, implement, test, deploy, and operate your own at scale.

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. Throughout his career, he has designed, secured, analyzed and tested complex software and infrastructure, with a particular focus on understanding how systems fail and how they can be made more secure.

Outside of work, Steve enjoys sharing knowledge with the technology community. He collaborates with researchers, industry experts and technology professionals to write practical books covering software development, cybersecurity, cloud computing, networking, DevOps, artificial intelligence and enterprise technologies. His books focus on practical learning through clear explanations, real-world examples and hands-on exercises. With more than two decades of industry experience, his goal is to help IT professionals, students and technology enthusiasts build useful skills and stay current in a rapidly changing industry.

We believe readers deserve to know how our books are created. Most of our authors are not native English speakers, so we use AI to help translate, proofread manuscripts, fix grammar, improve sentence structure and make technical explanations easier to read. AI is used as an editing tool only. It does not replace the research, technical knowledge or hands-on experience behind our books. Some of our authors also prefer to remain anonymous for privacy or professional reasons. In those cases, we publish their work under a different name. The author's name may be different, but the quality of the content and our review process remain the same.

Every book is written, reviewed and maintained by experienced technology professionals, with contributions from our private technical community of more than 420 engineers and researchers from Ukraine, Belarus and Russia. We spend far more time validating technical accuracy and keeping our content up to date than generating text. We are always interested in working with experienced professionals who have deep expertise in a particular technology or domain. If you would like to publish a book with us or help review an existing manuscript, we'd love to hear from you. Send us a message describing your area of expertise. We are especially interested in niche technologies, specialized skills and emerging topics that are underrepresented in existing technical literature.

If you look through the contents of our books, you'll see practical examples, detailed explanations and material that is regularly updated. Our goal is to publish books that professionals can actually rely on, not low-effort AI-generated content. If you ever feel that one of our books does not meet that standard, Leanpub offers a 60-day money-back guarantee. Feel free to request a refund if you are not satisfied with your purchase.

Contents

Table of Contents

Design, Implement, and Operate Production-Grade Systems Using Modern Engineering Practices

Introduction: Why Distributed Systems Are Harder Than They Look

  1. What Is a Distributed System?
  2. The Fallacies That Get Us in Trouble
  3. What This Book Will Do
  4. Technology Choices
  5. How to Read This Book
  6. What This Book Is Not
  7. The Mindset You Need

Chapter 1: Foundations of Distributed Computing

  1. What Is a Distributed System
  2. The Fundamentals: Latency, Bandwidth, and Reliability
  3. Concurrency and Parallelism
  4. Processes, Threads, and Event Loops
  5. Failure Modes in Distributed Systems
  6. Setting Up Your Development Environment

Chapter 2: Network Communication from the Ground Up

  1. Understanding TCP and UDP
  2. Building a TCP Server and Client
  3. Handling UDP for Low-Latency Communication
  4. Connection Management and Timeouts
  5. Building a Reliable Message Transport
  6. Networking Performance Tuning

Chapter 3: Serialization and Protocol Design

  1. Text-Based vs Binary Serialization
  2. Implementing JSON Serialization
  3. Building a Custom Binary Protocol
  4. Protocol Versioning and Compatibility
  5. Message Framing and Delimitation
  6. Encoding Efficiency and Performance Benchmarks

Chapter 4: Remote Procedure Calls

  1. The RPC Abstraction
  2. Designing Our RPC Protocol
  3. Implementing the Server-Side Dispatcher
  4. Building Client Stubs and Proxies
  5. Handling Timeouts and Retries
  6. Streaming and Long-Lived Connections

Chapter 5: Service Discovery and Load Balancing

  1. The Service Discovery Problem
  2. Building a Service Registry
  3. Health Checks and Instance Lifecycle
  4. Client-Side vs Server-Side Load Balancing
  5. Implementing Load Balancing Strategies
  6. DNS-Based Discovery Patterns

Chapter 6: Coordination and Leader Election

  1. The Need for Coordination
  2. Building a Distributed Lock Service
  3. Leader Election with Lease-Based Protocols
  4. Implementing Raft Consensus
  5. Log Replication Fundamentals
  6. Split-Brain and Quorum Decisions

Chapter 7: Data Replication and Distributed Logs

  1. Why Replicate Data
  2. Primary-Backup Replication
  3. Multi-Leader and Leaderless Replication
  4. Building a Distributed Log
  5. Consistency Models: Strong vs Eventual
  6. Handling Conflicts and Write Skew

Chapter 8: Transactions and Distributed Data

  1. The Distributed Transaction Problem
  2. Two-Phase Commit Protocol
  3. Saga Pattern for Long-Running Transactions
  4. Idempotency and Exactly-Once Semantics
  5. Consistent Hashing and Data Sharding
  6. Implementing a Distributed Key-Value Store

Chapter 9: Distributed Caching and Messaging

  1. Cache Architectures and Patterns
  2. Building a Distributed Cache
  3. Cache Invalidation Strategies
  4. Message Queues and Pub/Sub
  5. Dead Letter Queues and Retry Policies

Chapter 10: Event-Driven Architecture and Stream Processing

  1. Principles of Event-Driven Design
  2. Event Sourcing Patterns
  3. Command Query Responsibility Segregation
  4. Building a Stream Processing Pipeline
  5. Windowing and Aggregation
  6. Handling Out-of-Order Events

Chapter 11: Observability and Monitoring

  1. The Three Pillars of Observability
  2. Metrics Collection and Instrumentation
  3. Structured Logging Best Practices
  4. Distributed Tracing Implementation
  5. Building Operational Dashboards
  6. Alerting Strategies and Runbooks

Chapter 12: Resilience, Fault Tolerance, and Failure Detection

  1. Understanding Failure in Production
  2. Failure Detection and Heartbeats
  3. Circuit Breaker Pattern
  4. Bulkhead and Rate Limiting Patterns
  5. Implementing Retry with Backoff
  6. Chaos Engineering Practices

Chapter 13: The CAP Theorem, PACELC, and System Trade-offs

  1. Understanding the CAP Theorem
  2. Beyond CAP: The PACELC Theorem
  3. Choosing Your Consistency Level
  4. Partition Tolerance in Practice
  5. Latency vs Consistency Trade-offs
  6. Real-World Case Studies and Architectural Decisions

Chapter 14: Security, Authentication, and Authorization

  1. Security Threats in Distributed Systems
  2. Implementing TLS Between Services
  3. Mutual TLS Authentication
  4. Token-Based Authentication
  5. Authorization Models and RBAC
  6. Secrets Management and Rotation

Chapter 15: Production Deployment and Operations

  1. Containerizing Our Distributed System
  2. Kubernetes Deployment Strategies
  3. CI/CD Pipeline Design
  4. Blue-Green and Canary Deployments
  5. Capacity Planning and Autoscaling
  6. Production Operations and Incident Response

Conclusion: The Journey From First Principles to Production

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub