L4/L7 Load Balancing in Go: DSR & API Gateway Design

Answer-first: Building a Go API gateway with Envoy and NGINX enables L7 load balancing, JWT authentication, and token-bucket rate limiting at the ingress layer. Prerequisite: Part 2 of the System Design Masterclass. Read Part 1: System Design Thinking first. Load Balancing L4/L7 in Go — DSR, Rate Limiting & API Gateway Answer-first: L4 load balancing routes traffic at the transport layer using IP/TCP metadata with minimal CPU overhead, whereas L7 load balancing inspects HTTP headers, cookies, and URLs for intelligent content-based routing. Combining L4 Direct Server Return (DSR) with L7 Envoy API Gateways and Go token-bucket rate limiters handles peak traffic spikes smoothly. ...

June 18, 2026 · 10 min · Lê Tuấn Anh

Flash Sale Architecture: Rate Limiting & Redis

Flash Sale Architecture: Rate Limiting & Redis [!NOTE] On sourcing: This article describes flash-sale architecture patterns for C10M-scale events; it is not a disclosure of Shopee’s internal systems, and the figures here are engineering targets rather than published Shopee metrics. Shopee has not publicly documented its flash-sale internals in detail. What is public is its database platform choice — Shopee’s adoption of TiDB is documented in PingCAP’s case studies (How Shopee Chose the Right Database, Shopping on Shopee, the TiDB Way). Treat everything else as a reference pattern to validate against your own workload. ...

June 1, 2026 · 8 min · Lê Tuấn Anh

Shopee Microservices: Golang, gRPC & API Gateway

Answer-first: Shopee handles millions of concurrent users by migrating from monolithic systems to high-performance Go microservices. Inter-service gRPC Protobuf communication and Istio/Envoy service mesh sidecars enforce strict SLAs and sub-millisecond RPC latencies across thousands of internal microservice nodes. Chapter 1: Building a Massive Foundation with Microservices, Golang, and gRPC ← Series hub | Next → Prerequisite: This is the first chapter of the Shopee Architecture series. No prior reading is required to start here. You can view the full series roadmap at the Series Hub. ...

May 5, 2026 · 9 min · Lê Tuấn Anh

Blueprint: E-commerce Microservices Architecture with Golang

Ecommerce Microservices Architecture Diagram: 21-Service Blueprint E-Commerce Architecture Patterns: Monolith vs Microservices Answer-first: An ecommerce microservices architecture diagram organizes system capabilities into 6 core bounded domains (Commerce Flow, Product & Content, Logistics, Post-Purchase, Identity & Access, Platform Operations), connecting 21 Golang microservices via gRPC and Dapr Pub/Sub event mesh for high-concurrency scalability. Monolithic vs Microservices E-Commerce Comparison Dimension Monolithic E-Commerce Microservices E-Commerce Scaling Vertical scaling of entire monolith application Independent horizontal scaling per domain (e.g., Catalog 10x Cart) Database Architecture Single shared database with cross-table SQL joins Database-per-service (PostgreSQL, Redis, Elasticsearch) with zero cross-domain access Deployment Frequency Low frequency; all-or-nothing monolithic releases High frequency; independent CI/CD pipelines per microservice Fault Tolerance Low; a single bug or memory leak crashes the entire store High; failure in one domain (e.g., Reviews) does not block Checkout Complexity Low initial architectural and operational complexity High distributed complexity (Saga pattern, gRPC contracts, Dapr mesh) Operational Cost Lower initial cost; scales expensively at high traffic Higher initial infrastructure setup; cost-effective at high scale Practical latency and memory metrics comparing an Envoy-based API Gateway to a custom Go reverse proxy under 100k concurrent connections. How to tune circuit breaker thresholds (go-resiliency/breaker) to prevent premature service isolation during temporary network jitters. When transitioning from a monolithic platform to a distributed microservice setup, the hardest question isn’t “How do we write the code?” — it’s “How do these moving parts talk to each other safely, and why is each boundary drawn exactly where it is?” ...

April 12, 2026 · 10 min · Lê Tuấn Anh