REST vs gRPC
| Feature | REST | gRPC |
|---|---|---|
| Format | JSON (text) | Protocol Buffers (binary) |
| Transport | HTTP/1.1 or HTTP/2 | HTTP/2 |
| Contract | OpenAPI spec (optional) | .proto file (required) |
| Code gen | Manual | Auto-generated from .proto |
| Streaming | No (server-sent events possible) | Native (unary, server, client, bidirectional) |
| Browser support | Native | Limited (needs gRPC-web) |
gRPC is 7-10x faster than REST for internal service-to-service communication due to binary serialization and HTTP/2 multiplexing.
Service Mesh (e.g., Istio)
A dedicated infrastructure layer for handling service-to-service communication:
- Sidecar proxy (Envoy) runs alongside each microservice
- Handles: service discovery, load balancing, retries, mTLS, observability
- Developers write business logic; the mesh handles networking
Cloud Networking Concepts
VPC (Virtual Private Cloud)
An isolated virtual network within a cloud provider. You define:
- CIDR block (e.g., 10.0.0.0/16)
- Subnets (public = internet-facing, private = internal only)
- Route tables (where traffic goes)
- Internet Gateway (connects public subnets to the internet)
Internet
│
[Internet Gateway]
│
[Public Subnet 10.0.1.0/24] ← Load Balancer, Web servers
│
[NAT Gateway]
│
[Private Subnet 10.0.2.0/24] ← Database servers
Security Groups vs NACLs
| Security Group | NACL | |
|---|---|---|
| Scope | Instance level | Subnet level |
| State | Stateful (auto-allows return traffic) | Stateless (must allow both directions) |
| Rules | Allow only | Allow and Deny |
| Evaluation | All rules evaluated together | Rules evaluated in order (lowest number first) |
Q: Why is gRPC faster than REST?
A: (1) Protocol Buffers are binary — smaller (3-10x) and faster to parse than JSON. (2) HTTP/2 multiplexing lets many requests share one connection without head-of-line blocking. (3) Strong typing in .proto files eliminates parsing ambiguities.
Q: Difference between Security Groups and NACLs?
A: Security Groups are stateful (allow inbound → auto-allow outbound) and operate at the instance level. NACLs are stateless (must explicitly allow both directions) and operate at the subnet level. Security Groups support allow-only; NACLs support both allow and deny.
Q: What is a VPC?
A: Your own private network segment in the cloud. You define the IP range, subdivide into public/private subnets, and control routing. It’s like having your own data center with complete control over network topology.
Q: What problem does a service mesh solve?
A: It moves networking concerns (retries, service discovery, encryption, observability) out of application code into a sidecar proxy. Developers write business logic; the mesh handles the rest consistently across all services.
Premium Content
Unlock Microservices & Cloud Networking and all premium lessons with a subscription.
From ₹199.99/year — See plans