gRPC Microservices in Go

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Build super fast and super secure microservices with the gRPC high-performance messaging protocol and powerful Go language. In gRPC Microservices in Go you’ll learn: • Designing and implementing resilient microservice architecture • Testing microservices • Deploying microservices to the cloud with modern orchestration tools • Monitoring and overseeing microservices The powerful gRPC Remote Procedure Call framework delivers superior speed and security over protocols like REST. When paired with Golang’s low-level efficiency and flexibility, gRPC and Go become a killer combination for latency-sensitive microservices applications. gRPC Microservices in Go shows you how to utilize these powerful tools to build production-grade microservices. You’ll learn to develop microservice inter-service communication patterns that are powered by gRPC, design backward compatible APIs, and apply hexagonal architecture to microservices. About the technology Go is perfect for writing fast, reliable microservices code, but that’s only half the story. You also need a communications framework like gRPC to connect your services and handle load balancing, tracing, health checking, and authentication. Together, Go and gRPC accelerate the development process and eliminate many of the challenges you face when building and deploying microservices. About the book gRPC Microservices in Go teaches you how to build production-ready microservices using Go and gRPC. In it, you’ll learn to create efficient APIs in Go, use gRPC for network communication, and deploy on cloud and Kubernetes. Helpful examples, including a complete eCommerce web app, make it easy to grasp each concept. You’ll also get an inside look at testing, deployment, and efficient DevOps practices for microservices. What's inside • Designing and implementing resilient microservice architecture • Testing microservices • Cloud deploying microservices with orchestration tools • Monitoring and overseeing microservices About the reader For software developers who know the basics of Go. About the author Hüseyin Babal has been using Go in production since 2017 to build and maintain SaaS platforms.

Author(s): Hüseyin Babal
Edition: 1
Publisher: Manning Publications
Year: 2023

Language: English
Commentary: Publisher's PDF
Pages: 200
City: Shelter Island, NY
Tags: Microservices; Deployment; Go; Unit Testing; Integration Testing; Testing; Observability; gRPC; End-to-end Testing

gRPC Microservices in Go
brief contents
contents
preface
acknowledgments
about this book
Who should read this book
How this book is organized: A road map
About the code
liveBook discussion forum
about the author
about the cover illustration
Part 1: gRPC and microservices architecture
Chapter 1: Introduction to Go gRPC microservices
1.1 Benefits of gRPC microservices
1.1.1 Performance
1.1.2 Code generation and interoperability
1.1.3 Fault tolerance
1.1.4 Security
1.1.5 Streaming
1.2 REST vs. RPC
1.3 When to use gRPC
1.3.1 Who is this book for?
1.4 Production-grade use cases
1.4.1 Microservices
1.4.2 Container runtime
1.4.3 CI/CD pipeline
1.4.4 Monitoring and observability
1.4.5 Public access
Chapter 2: gRPC meets microservices
2.1 Monolithic architecture
2.1.1 Development
2.1.2 Deployment
2.1.3 Scaling
2.2 Scale cube
2.2.1 X-axis scaling
2.2.2 Z-axis scaling
2.2.3 Y-axis scaling
2.3 Microservice architecture
2.3.1 Handling data consistency
2.3.2 Saga pattern
2.3.3 Choreography-based saga
2.3.4 Orchestrator-based saga
2.4 Service discovery
2.5 Using gRPC for interservice communication
2.5.1 Working with protocol buffers
2.5.2 Generating Go source code
2.5.3 Connecting wires
Part 2: Developing, testing, and deploying a gRPC microservice application
Chapter 3: Getting up and running with gRPC and Golang
3.1 Protocol buffers
3.1.1 Defining message type
3.1.2 Protocol buffer encoding
3.2 Generating stubs
3.2.1 Protocol buffer compiler installation
3.2.2 Using the protocol buffer compiler
3.3 Maintaining .proto files
3.3.1 Proto project structure
3.3.2 Automation for source code generation
3.4 Backward and forward compatibility
3.4.1 Adding new fields
3.4.2 Upgrading the server but not the client
3.4.3 Upgrading the client but not the server
3.4.4 Adding/removing oneof fields
3.4.5 Moving fields out of or into oneof fields
Chapter 4: Microservice project setup
4.1 Hexagonal architecture
4.1.1 Application
4.1.2 Actors
4.1.3 Ports
4.1.4 Adapters
4.2 Order service implementation
4.2.1 Project folders
4.2.2 Initializing a Go project
4.2.3 Implementing the application core
4.2.4 Implementing ports
4.2.5 Implementing adapters
4.2.6 Implementing a gRPC adapter
4.2.7 Dependency injection and running the application
4.2.8 Calling a gRPC endpoint
Chapter 5: Interservice communication
5.1 gRPC service-to-service communication
5.1.1 Server-side load balancing
5.1.2 Client-side load balancing
5.2 Depending on a module and implementing ports and adapters
5.2.1 Payment port
5.2.2 Payment adapter
5.2.3 Implementing the payment port
5.2.4 Implementing the payment adapter
5.2.5 Client configuration for a payment stub
5.2.6 Using a payment adapter in gRPC
5.3 Error handling
5.3.1 Status codes
5.3.2 Returning an error code and message
5.3.3 Errors with details
5.3.4 Handling errors on the client side
5.3.5 Running the Payment service
Chapter 6: Resilient communication
6.1 Resiliency patterns
6.1.1 Timeout pattern
6.1.2 Retry pattern
6.1.3 Circuit breaker pattern
6.2 Error handling
6.2.1 gRPC error model
6.2.2 gRPC error response
6.3 Securing gRPC communication
6.3.1 TLS handshake
6.3.2 Certificate generation
6.3.3 gRPC TLS credentials
Chapter 7: Testing microservices
7.1 Testing pyramid
7.2 Testing with a unit test
7.2.1 System under test
7.2.2 Test workflow
7.2.3 Working with mocks
7.2.4 Implementing a mock
7.2.5 Automatic mock generation
7.3 Integration testing
7.3.1 Test suite preparation
7.3.2 Working with Testcontainers
7.4 End-to-end tests
7.4.1 Specifications
7.4.2 Understanding Docker Compose service definitions
7.4.3 End-to-end test folder structure
7.4.4 Database layer
7.4.5 The Payment service layer
7.4.6 The Order service layer
7.4.7 Running tests against the stack
7.5 Test coverage
7.5.1 Coverage information
7.5.2 Testing in a CI pipeline
Chapter 8: Deployment
8.1 Docker
8.1.1 Building images
8.2 Kubernetes
8.2.1 Kubernetes architecture
8.2.2 Kubernetes resources
8.2.3 Eagle view of microservices deployment
8.2.4 Pod
8.2.5 Deployment
8.2.6 Service
8.2.7 NGINX Ingress controller
8.3 Certificate management
8.3.1 Installation
8.3.2 ClusterIssuer
8.3.3 Certificate usage in Ingress
8.3.4 Certificates on the client side
8.4 Deployment strategies
8.4.1 RollingUpdate
8.4.2 Blue-Green Deployment
8.4.3 Canary deployment
8.4.4 Final thoughts on deployment
Part 3: gRPC and microservices architecture
Chapter 9: Observability
9.1 Observability
9.1.1 Traces
9.1.2 Metrics
9.1.3 Logs
9.2 OpenTelemetry
9.2.1 Instrumentation locations
9.2.2 Instrumentation
9.2.3 Metric backend
9.2.4 Service performance monitoring
9.3 Observability in Kubernetes
9.3.1 Jaeger All in One
9.3.2 OpenTelemetry Collector
9.3.3 Prometheus
9.3.4 Jaeger installation
9.3.5 OpenTelemetry interceptor for the Order service
9.3.6 Understanding the metrics of the Order service
9.3.7 Application logging
9.3.8 Logs collection
9.3.9 Elasticsearch as a logging backend
9.3.10 Kibana as a logging dashboard
index
Symbols
Numerics
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
R
S
T
U
V
W
X
Y
Z