What this book covers
Chapter 1, Introduction to Microservices, covers the key benefits of and common issues with a microservice architecture, helping you understand which problems microservices solve and which challenges they usually introduce. The chapter emphasizes the role of the Go programming language in microservice development and lays down the foundation for the rest of the book.
Chapter 2, Scaffolding Go Microservices, introduces you to the main principles of the Go programming language and provides the most important recommendations for writing Go code. It covers the process of setting up the right structure to organize the microservice code in Go and introduces you to an example application consisting of three microservices. Finally, the chapter illustrates how to scaffold the code for each of the example microservices. The example microservices implemented in this chapter are going to be used throughout the book, with each chapter adding new features to them.
Chapter 3, Service Discovery, talks about the problem of service discovery and illustrates how different services can find each other in a microservice environment. It covers the most popular service discovery tools and walks you through the steps of adding service discovery logic to the example microservices from the previous chapter.
Chapter 4, Serialization, brings us to the concept of data serialization, which is required for understanding upcoming chapters covering microservice communication. It introduces the Protocol Buffers data format, which is going to be used for encoding and decoding the data transferred between our example microservices. The chapter provides examples of how to define serializable data types and generate code for them, and how to use the generated code in Go microservices.
Chapter 5, Synchronous Communication, covers the topic of synchronous communication between microservices. It illustrates how to define service APIs using the Protocol Buffers format and introduces you to gRPC, a service communication framework. The chapter wraps up with examples of how to implement microservice gateways and clients and perform remote calls between our microservices.
Chapter 6, Asynchronous Communication, talks about asynchronous communication between microservices. It introduces you to a popular asynchronous communication tool, Apache Kafka, and provides examples of sending and receiving messages, using it for our example microservices. The chapter wraps up with an overview of best practices for using asynchronous communication in microservice environments.
Chapter 7, Persistence and Databases, covers the topic of persisting service data in databases. You will learn about the common types of databases and the benefits they bring to software developers. The chapter walks you through the process of implementing the logic for storing service data in a MySQL database.
Chapter 8, Setting Up Service Deployments, talks about service deployment and provides an overview of a popular deployment and orchestration platform, Kubernetes. The chapter illustrates how to prepare service code for deployment and how to deploy it using Kubernetes. It also includes best practices for deploying microservice applications.
Chapter 9, Unit and Integration Testing, describes the common techniques of testing Go microservice code. It covers the basics of Go unit and integration testing and demonstrates how to test the microservice code from the previous chapters. The chapter wraps up with the industry’s best practices for writing and organizing tests.
Chapter 10, Security and Compliance, covers the main aspects of Go microservice security, such as authentication, authorization, secret management, and vulnerability analysis. The chapter illustrates how to implement service-level authentication and access control with JSON Web Tokens.
Chapter 11, Reliability Overview, introduces you to the topic of system reliability and describes the core principles, instruments, and industry best practices for building reliable and highly available microservices. It illustrates how to automate service responses to various types of failures, as well as how to establish the processes for keeping service reliability under control.
Chapter 12, Collecting Service Telemetry Data, provides a detailed overview of modern instruments and solutions for collecting service telemetry data, such as logs, metrics, and traces. The chapter provides lots of detailed examples of collecting all different types of telemetry data and lists some of the best practices for working with them.
Chapter 13, Setting Up Service Alerting, illustrates how to set up automated incident detection and notification for microservices, using the telemetry data collected in the previous chapter. It introduces you to a popular alerting and monitoring tool, Prometheus, and shows how to set up Prometheus alerts for our example microservices.
Chapter 14, Performance Monitoring, describes the common techniques of tracking Go microservice performance, such as memory and CPU profiling and dashboarding. The chapter provides practical examples of setting up service performance dashboards using a popular Grafana tool.
Chapter 15, Implementing Distributed System Scenarios, covers some common distributed system problems and solutions that Go service developers might face while building advanced applications.
Chapter 16, Advanced Topics, wraps up the last part of the book and covers some of the advanced topics in microservice development, such as static code analysis, data validation, streaming APIs, service ownership, and frameworks. The chapter includes examples of data validation techniques, static code checks, and streaming API client and server logic.