Study guide

2.3 REST, gRPC, and Protobuf Contracts

Google Cloud Professional Cloud Developer Exam

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Exam and Compute Platform Decisions

1.1 Current Exam, Sources, and Scenario Method 1.2 Cloud Run Execution and Platform Selection 1.3 GKE Modes and Compute Engine Trade-offs

2 Chapter 2: Container Engineering and API Contracts

2.1 Stateless Microservices and Multi-stage Builds 2.2 Container Hardening, Signals, and Layer Caching 2.3 REST, gRPC, and Protobuf Contracts

3 Chapter 3: gRPC Compatibility and Geographic Routing

3.1 Schema Evolution and gRPC Routing 3.2 Geography, Network Tiers, and Load Balancers 3.3 Serverless NEGs, Sessions, and Edge Controls

4 Chapter 4: API Management and Caching

4.1 API Management & Rate Limiting with Apigee and API Gateway 4.2 Memorystore and Cache Access Patterns 4.3 Cache Invalidation, Capacity, and Failover

5 Chapter 5: Messaging, Task Dispatch, and Orchestration

5.1 Event-Driven Messaging with Cloud Pub/Sub 5.2 Task Queues & Rate Throttling with Cloud Tasks 5.3 Event Routing and Service Orchestration: Eventarc & Cloud Workflows

6 Chapter 6: Resilience and Relational Availability

6.1 Designing Resilient Systems: Circuit Breaking, Retries & Failover 6.2 Cloud SQL Availability and Recovery 6.3 Connection Budgets and Spanner Consistency

7 Chapter 7: Distributed Schemas and NoSQL Data Models

7.1 Spanner Keys, Indexes, and Transactions 7.2 Firestore Data, Indexes, and Transactions 7.3 Bigtable Row Keys and Replication

8 Chapter 8: Object Storage and Application Identity

8.1 Cloud Storage Lifecycle and Signed Access 8.2 Workload Identity and Service Authentication 8.3 Secret Delivery, Rotation, and IAP

9 Chapter 9: Security, Data Integration, and Developer Credentials

9.1 Private Communication, Key Rotation, and Vulnerability Response 9.2 AlloyDB Schemas and BigQuery Ingestion 9.3 CLI Configurations, Local ADC, and Cloud Shell

10 Chapter 10: Managed Development and Automated Tests

10.1 Cloud Workstations and the Container Inner Loop 10.2 Emulating Google Cloud Services & Database Auth Proxies 10.3 Automated Testing Strategies: Unit, Integration, and Mocking

11 Chapter 11: AI Development Tools and Build Pipelines

11.1 AI Coding Assistants, Context, MCP, and Test Review 11.2 Cloud Build Workers and Step Dependencies 11.3 Builders, Substitutions, Triggers, and IAM

12 Chapter 12: Artifact Security and Admission Policies

12.1 Artifact Management and Vulnerability Scanning with Artifact Registry 12.2 Build Provenance and Admission Concepts 12.3 Attestors, Policy Enforcement, and Break-glass

13 Chapter 13: Cloud Run and GKE Deployment Configuration

13.1 Cloud Run Deployment and Scaling Configuration 13.2 Cloud Run CPU, Private Egress, and Secrets 13.3 GKE Workload Controllers and Gateway Routing

14 Chapter 14: Kubernetes Resources, Health, and Progressive Releases

14.1 GKE Resources, OOM Diagnosis, and Autoscaling 14.2 Container Health Probes, Lifecycle Hooks & Graceful Shutdown 14.3 Progressive Delivery: Traffic Splitting, Canary, and Blue/Green Rollouts

15 Chapter 15: Source/Event Deployment and Cloud API Integration

15.1 Source Deployment, Event Receivers, and API Versions 15.2 Client Libraries, Service Enablement, and ADC 15.3 API Responses, Pagination, Caches, and Retries

16 Chapter 16: Tracing, Sampling, and Monitoring

16.1 Trace Context and OpenTelemetry Export 16.2 Custom Spans, Trace Analysis, and Sampling 16.3 Application Metrics, Health Checks & Alerting with Cloud Monitoring

17 Chapter 17: Structured Logs, Routing, and Error Management

17.1 Structured Logs, Trace Correlation, and Queries 17.2 Log Routing, Export Destinations, and Exclusions 17.3 Error Reporting Formats and Regression Handling

18 Chapter 18: Profiling, Generative AI, and Assisted Troubleshooting

18.1 Cloud Profiler Types and Flame Graph Analysis 18.2 Generative AI Integration with the Google Gen AI SDK 18.3 Evidence-Based Troubleshooting with AI Assistance

2.3 REST, gRPC, and Protobuf Contracts

Key Takeaways Explain This Topic AI

REST can use modern HTTP versions; gRPC commonly uses HTTP/2 and generated Protobuf interfaces.

Protobuf numeric tags identify fields on the binary wire.

A correct transport and schema still require business validation, authorization and bounded calls.

Last updated: October 2026

High-Performance API Design: REST vs. gRPC and Protobufs

Inter-service communication in distributed microservices architectures must balance performance, network efficiency, language interoperability, and schema evolution. The Google Cloud Professional Cloud Developer exam requires in-depth technical knowledge of REST (Representational State Transfer) versus gRPC (Google Remote Procedure Call) , Protocol Buffers ( proto3 ), streaming patterns, and the architectural mechanics of deploying and load balancing gRPC services on Cloud Run and GKE .

REST vs. gRPC Architectural Comparison

REST APIs are convenient for browser and public integrations and can run over HTTP/1.1, HTTP/2, or HTTP/3. gRPC commonly uses HTTP/2 and generated Protobuf contracts for internal RPCs. Select the interface from client support, streaming, interoperability, and measured performance requirements.

Architectural Dimension REST (over HTTP/1.1) gRPC (over HTTP/2)

Transport Protocol HTTP/1.1 (TCP connection per request or keep-alive) HTTP/2 (Persistent single TCP connection with bi-directional multiplexing)

Payload Format Text-based JSON, XML (human-readable, verbose) Binary Protocol Buffers (compact, strongly typed, machine-optimized)

Header Compression None (headers transmitted in plain text on every request) HPACK header compression (eliminates redundant header overhead)

Streaming Capabilities Unidirectional (Server-Sent Events) or separate protocols (WebSockets) Native 4-way streaming (Unary, Server, Client, Bidirectional full-duplex)

Contract Definition Optional / external (OpenAPI/Swagger JSON/YAML schemas) Mandatory, strictly typed .proto interface definition files

Code Generation Third-party generators (varying quality and support) First-class native code generation across 10+ languages via protoc

Browser Support Universal native browser support (Fetch API, Axios) Limited native browser support (requires gRPC-Web proxy)

CPU & Network Overhead High (JSON parsing/serialization and large text payloads) Low (binary encoding/decoding and compact wire representations)

Primary Use Case Public APIs, third-party integrations, browser clients Internal east-west microservices, high-throughput data pipelines

Protocol Buffers (proto3) Architecture & Serialization

Protocol Buffers (Protobuf) is Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. Protobuf payloads are serialized into compact binary streams using Type-Length-Value (TLV) or Varint encoding rather than text representations, often reducing wire size and parsing overhead compared with JSON; actual results depend on the schema, data, and implementation.

Concrete Protobuf Schema Definition syntax = "proto3";

package commerce.orders.v1;

option go_package = "github.com/example/commerce/v1/orders;ordersv1";

// OrderService provides APIs for managing customer purchase transactions.

  • service OrderService {
  • // Unary RPC: Single request, single response
  • rpc CreateOrder (CreateOrderRequest) returns (OrderResponse);
  • // Server Streaming RPC: Single request, continuous status updates
  • rpc StreamOrderStatus (OrderStatusRequest) returns (stream OrderStatusUpdate);
  • // Client Streaming RPC: Stream of sensor events, single summary response
  • rpc IngestTelemetry (stream TelemetryBatch) returns (IngestSummary);
  • // Bidirectional Streaming RPC: Full-duplex interactive conversation
  • rpc OrderChatSession (stream ChatMessage) returns (stream ChatMessage);
  • }
  • message CreateOrderRequest {
  • // Numeric field tags 1-15 require only 1 byte on the wire
  • string order_id = 1;
  • string customer_id = 2;
  • repeated OrderItem items = 3;
  • int64 created_at_timestamp = 4;
  • // Reserved tags and names prevent silent data corruption during schema evolution
  • reserved 5, 8 to 11;
  • reserved "discount_code", "legacy_tax_identifier";
  • }
  • message OrderItem {
  • string product_id = 1;
  • int32 quantity = 2;
  • double unit_price = 3;
  • }
  • message OrderResponse {
  • string order_id = 1;
  • enum OrderStatus {
  • ORDER_STATUS_UNSPECIFIED = 0; // First enum value must always be 0
  • ORDER_STATUS_PENDING = 1;
  • ORDER_STATUS_CONFIRMED = 2;
  • ORDER_STATUS_REJECTED = 3;
  • }
  • OrderStatus status = 2;
  • string transaction_hash = 3;
  • }
  • message OrderStatusRequest { string order_id = 1; }
  • message OrderStatusUpdate {
  • string order_id = 1;
  • OrderResponse.OrderStatus status = 2;
  • }
  • message TelemetryBatch { repeated string events = 1; }
  • message IngestSummary { int64 accepted_events = 1; }
  • message ChatMessage { string text = 1; }
  • Numeric Field Tags and Wire Optimization

Field Tag Range: Every field inside a Protobuf message is identified on the wire by its unique numeric field tag , not by its field name.

Tags 1 through 15: Encoded using a single byte (1 byte for both the field number and wire type). Always allocate tags 1 through 15 to the most frequently transmitted fields.

Tags 16 through 2047: Encoded using two bytes. Use these for less frequent or optional fields.

Resource Semantics and Safe Client Behavior

Choose resource names, methods and errors as part of the contract. A REST order resource can expose a stable identifier and a separate operation to submit payment; it should not interpret an ordinary GET as permission to charge. Paginated list responses need an opaque continuation token and stable documented filters. An API version records consumer expectations, not merely the container revision implementing them.

A gRPC client also needs an explicit deadline and cancellation propagation. A compact payload and one HTTP/2 connection do not prevent a slow dependency from holding resources indefinitely. Decide which methods are safe to retry, preserve a stable idempotency key for effectful operations, and distinguish application errors from transport failures. A successful decode proves only that bytes match the expected wire structure; validate business constraints such as positive quantities and authorized customer IDs separately.

Benchmark representative payloads and client platforms before selecting a protocol solely for performance. A browser-facing JSON API can be simpler than deploying a translation proxy, while a controlled internal client fleet can benefit from generated RPC contracts and streaming. Either choice still needs authentication, authorization, observability and compatibility tests.

Official references checked October 18, 2026: Google Cloud 1 .