gRPC: Up and Running

Book description

Get a comprehensive understanding of gRPC fundamentals through real-world examples. With this practical guide, you’ll learn how this high-performance interprocess communication protocol is capable of connecting polyglot services in microservices architecture, while providing a rich framework for defining service contracts and data types.

Complete with hands-on examples written in Go, Java, Node, and Python, this book also covers the essential techniques and best practices to use gRPC in production systems. Authors Kasun Indrasiri and Danesh Kuruppu discuss the importance of gRPC in the context of microservices development.

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Why Did We Write This Book?
    2. Who Is This Book For?
    3. How This Book Is Organized
    4. Using Code Examples
    5. Conventions Used in This Book
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Acknowledgments
  2. 1. Introduction to gRPC
    1. What Is gRPC?
      1. Service Definition
      2. gRPC Server
      3. gRPC Client
      4. Client–Server Message Flow
    2. Evolution of Inter-Process Communication
      1. Conventional RPC
      2. SOAP
      3. REST
      4. Inception of gRPC
      5. Why gRPC?
      6. gRPC Versus Other Protocols: GraphQL and Thrift
    3. gRPC in the Real World
      1. Netflix
      2. etcd
      3. Dropbox
    4. Summary
  3. 2. Getting Started with gRPC
    1. Creating the Service Definition
      1. Defining Messages
      2. Defining Services
    2. Implementation
      1. Developing a Service
      2. Developing a gRPC Client
    3. Building and Running
      1. Building a Go Server
      2. Building a Go Client
      3. Running a Go Server and Client
      4. Building a Java Server
      5. Building a Java Client
      6. Running a Java Server and Client
    4. Summary
  4. 3. gRPC Communication Patterns
    1. Simple RPC (Unary RPC)
    2. Server-Streaming RPC
    3. Client-Streaming RPC
    4. Bidirectional-Streaming RPC
    5. Using gRPC for Microservices Communication
    6. Summary
  5. 4. gRPC: Under the Hood
    1. RPC Flow
    2. Message Encoding Using Protocol Buffers
      1. Encoding Techniques
    3. Length-Prefixed Message Framing
    4. gRPC over HTTP/2
      1. Request Message
      2. Response Message
      3. Understanding the Message Flow in gRPC Communication Patterns
    5. gRPC Implementation Architecture
    6. Summary
  6. 5. gRPC: Beyond the Basics
    1. Interceptors
      1. Server-Side Interceptors
      2. Client-Side Interceptors
    2. Deadlines
    3. Cancellation
    4. Error Handling
    5. Multiplexing
    6. Metadata
      1. Creating and Retrieving Metadata
      2. Sending and Receiving Metadata: Client Side
      3. Sending and Receiving Metadata: Server Side
      4. Name Resolver
    7. Load Balancing
      1. Load-Balancer Proxy
      2. Client-Side Load Balancing
      3. Compression
    8. Summary
  7. 6. Secured gRPC
    1. Authenticating a gRPC Channel with TLS
      1. Enabling a One-Way Secured Connection
      2. Enabling an mTLS Secured Connection
    2. Authenticating gRPC Calls
      1. Using Basic Authentication
      2. Using OAuth 2.0
      3. Using JWT
      4. Using Google Token-Based Authentication
    3. Summary
  8. 7. Running gRPC in Production
    1. Testing gRPC Applications
      1. Testing a gRPC Server
      2. Testing a gRPC Client
      3. Load Testing
      4. Continuous Integration
    2. Deployment
      1. Deploying on Docker
      2. Deploying on Kubernetes
    3. Observability
      1. Metrics
      2. Logs
      3. Tracing
    4. Debugging and Troubleshooting
      1. Enabling Extra Logging
    5. Summary
  9. 8. The gRPC Ecosystem
    1. gRPC Gateway
    2. HTTP/JSON Transcoding for gRPC
    3. The gRPC Server Reflection Protocol
    4. gRPC Middleware
    5. Health Checking Protocol
    6. gRPC Health Probe
    7. Other Ecosystem Projects
    8. Summary
  10. Index

Product information

  • Title: gRPC: Up and Running
  • Author(s): Kasun Indrasiri, Danesh Kuruppu
  • Release date: January 2020
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492058335