Distributed Services in Go
Distributed Services in Go
Summary:
Introduction
The book «Distributed Services with Go» by Travis Jeffrey was published in 2021 and immediately attracted the attention of developers working with the Go language (Golang). This is not another syntax reference, but a practical guide to building real distributed systems. The author invites the reader to journey from writing a simple HTTP server to deploying a full-fledged fault-tolerant service in Kubernetes using gRPC, the Raft protocol, and modern observability practices.
The book consists of 256 pages and is aimed at those already familiar with the basics of Go who want to delve deeper into the architecture of distributed applications. Travis Jeffrey is an experienced engineer who has worked at Heroku and other technology companies, so his advice is backed by real-world experience.
What the book is about
The main idea of the book is to show how to build a distributed service "from scratch" using only standard Go tools and libraries, and then gradually add functionality: replication, service discovery, security, and deployment. Each chapter is dedicated to a specific aspect:
- Chapters 1-2: Basics of gRPC and Protocol Buffers — how to define an API and generate code.
- Chapters 3-4: Implementing the server and client, error handling, data streaming.
- Chapter 5: Introduction to the Raft consensus algorithm and its implementation using the hashicorp/raft library.
- Chapter 6: Log replication and ensuring fault tolerance.
- Chapter 7: Service discovery and dynamic configuration.
- Chapter 8: Security: TLS, authentication, and authorization.
- Chapter 9: Observability: structured logging, metrics (Prometheus), and tracing (OpenTelemetry).
- Chapter 10: Deployment in Kubernetes: writing Dockerfiles, manifests, Helm charts.
Each chapter contains practical code examples that can be run and modified. By the end of the book, the reader obtains a ready-made distributed service for storing and replicating logs.
Who this book is for
The book is aimed at intermediate Go developers who already know how to write simple Go applications and want to move on to building distributed systems. It will also be useful for:
- Backend engineers interested in microservice architecture.
- DevOps specialists who want to better understand the internal workings of services.
- Students and instructors of distributed computing courses.
It is advisable to know the basics of Go (goroutines, channels, interfaces) and have a general understanding of network protocols (TCP/IP, HTTP). Knowledge of Kubernetes and gRPC is not required — the author explains everything from scratch.
What the reader will learn
After reading the book, you will be able to:
- Design and implement gRPC APIs using Protocol Buffers.
- Embed the Raft consensus algorithm to ensure fault tolerance.
- Configure service discovery using an etcd or Consul client.
- Add encryption and authentication via TLS.
- Integrate structured logging, metrics, and distributed tracing.
- Package the application into a Docker image and deploy it in Kubernetes.
- Write tests for distributed components.
Strengths
One of the main advantages of the book is its practical focus. You don't just read theory; you write code that can be used immediately. The author uses current versions of libraries and tools (Go 1.16+, gRPC, Kubernetes).
The book is well-structured: each chapter begins with a problem statement and ends with a summary. The code is commented, and complex concepts (e.g., Raft) are explained