Introduction to gRPC

Jul 16, 2024

Lecture on gRPC by Brian Trong

Introduction

  • Speaker: Brian Trong
  • Topic: gRPC (gRPC Remote Procedure Call)
  • Introduced: 2015
  • Governance: Cloud Native Computing Foundation

Overview Example

  • Application Setup: Front-end communicates with back-end microservices
    • Microservices language examples: Python (analytics), Java, Golang
    • Communication Focus: Only between microservices (not front-end to back-end)

Key Features of gRPC

Convenience & Scalability

  • Without gRPC: Diverse HTTP client libraries by language (Python, Java, Golang)
  • With gRPC: Unified HTTP/2.0 connection handling, reducing complexity for developers

Code Generation

  • Protocol Buffers (protobuf): Define communication contracts
    • Schema Definition: Fields, object types, required/optional fields
  • Remote Procedure Calls (RPCs): Define remotely callable procedures
  • Compiler Role: Transforms protofile into source code in specific language
    • Example: Generates Java classes/interfaces as per protofile schema

Performance

  • HTTP/2.0 vs. HTTP/1.1: Enhanced performance with modern protocol
  • Protocol Buffers Serialization: Sends as binaries, more efficient than JSON
    • JSON Limitations: Not compressed, inefficiency in key-value pairs
  • Alternative Compression (e.g., gzip): Requires manual implementation across microservices
    • gRPC Advantage: Handles compression uniformly, reducing developer burden

Summary

  • Convenience: Code generation, simplified client libraries
  • Performance: Modern protocol, efficient binary serialization
  • Not a Universal Solution: Effective for certain application scenarios

Recommendations

  • Further Learning: Videos suggested by the speaker
  • Engagement: Questions via comments, subscribe for updates