Bài 1: Nền tảng Microservices — Go, gRPC và API Gateway

Bài 1: Nền tảng Microservices — Go, gRPC và API Gateway

Mục lục Series | Chương tiếp theo: Bài 2: Kiến trúc Flash Sale — Bí ẩn phía sau Redis và Hot Keys → Answer-first: Nền tảng Microservices của Shopee sử dụng ngôn ngữ Go kết hợp gRPC và Protobuf ở tầng giao tiếp nội bộ để tối ưu hiệu năng và throughput. Tầng API Gateway đảm nhiệm định tuyến thông minh, xác thực JWT, và rate limiting phân tán nhằm bảo vệ các service nghiệp vụ phía sau. ...

5 tháng 5, 2026 · 5 phút · Lê Tuấn Anh
Cân Bằng Tải L4/L7 & Giới Hạn Tốc Độ (Rate Limiting) — DSR, API Gateway & Token Bucket

Cân Bằng Tải L4/L7 & Giới Hạn Tốc Độ (Rate Limiting) — DSR, API Gateway & Token Bucket

← Chương trước: Tư Duy System Design & Các Sự Đánh Đổi — CAP, PACELC & Clean Architecture | Mục lục Series | Chương tiếp theo: Chiến Lược Caching & Bệnh Đàn Voi Giẫm Đạp (Cache Stampede) — Singleflight, XFetch & Redis LFU → Answer-first: Cân bằng tải phân lớp L4 (DSR qua HAProxy/IPVS) và L7 (API Gateway Envoy/Kong) tối ưu hóa định tuyến và giảm độ trễ mạng. Kết hợp middleware Token Bucket bằng Go với atomic operations cho phép giới hạn tốc độ truy cập chính xác và bảo vệ hệ thống trước bão request. ...

18 tháng 6, 2026 · 14 phút · Lê Tuấn Anh
Phần 4: Tích Hợp API Golang & Microservices (Kratos & Dapr)

Phần 4: Tích Hợp API Golang & Microservices (Kratos & Dapr)

← Chương trước: Phần 3: Chỉ Mục Không Gian (Uber H3, PostGIS & Redis GEO) | Mục lục Series | Chương tiếp theo: Phần 5: UI Trực Quan Hóa Lộ Trình Bằng Mapbox & Deck.gl → Answer-first: Golang API Gateway xây dựng trên Kratos và Dapr chịu trách nhiệm quản lý kết nối, phân phối tải tới cụm GraphHopper, triển khai Circuit Breaker chống sập lan truyền và xử lý ma trận lộ trình bất đồng bộ qua hàng đợi sự kiện. ...

14 tháng 6, 2026 · 7 phút · Lê Tuấn Anh
Chương 6: API Gateway Đấu Với Service Mesh Trong Kiến Trúc

Chương 6: API Gateway Đấu Với Service Mesh Trong Kiến Trúc Microservices

← Chương trước: Chương 5 — Tối Ưu Connection Pools | Mục lục Series | Chương tiếp theo: Chương 7 — Thiết Kế Idempotency APIs → Answer-first: API Gateway kiểm soát traffic trục Bắc-Nam (từ client bên ngoài vào) đảm nhiệm xác thực (Auth), Rate Limiting và chuyển đổi giao thức. Trong khi đó, Service Mesh (Istio/Envoy sidecars) thống lĩnh traffic trục Đông-Tây (nội bộ giữa các service) để bảo kê mTLS, Circuit Breaking và Distributed Tracing. ...

9 tháng 6, 2026 · 6 phút · Lê Tuấn Anh
High-Throughput Local LLM Gateway: Go & vLLM Blueprint

High-Throughput Local LLM Gateway: Go & vLLM Blueprint

High-throughput local LLM architecture guide combining vLLM PagedAttention virtual memory, Prefill-Decode disaggregation over RoCE v2/NVLink, and a custom Go API Gateway with SHA256 prompt prefix context-affinity routing, zero-allocation SSE streaming, and 71% cost savings over SaaS APIs.

6 tháng 8, 2026 · 23 phút · Tuấn Anh
21-service Go ecommerce microservices architecture diagram and blueprint

21-Service Go Ecommerce Microservices Diagram

21-Service Go Ecommerce Microservices Diagram E-Commerce Architecture Patterns: Monolith vs Microservices Answer-first: An ecommerce microservices architecture diagram structures enterprise retail platforms into 6 bounded domains—Commerce Flow, Product & Content, Logistics, Post-Purchase, Identity & Access, and Platform Operations—powering 21 Go microservices. Orchestrated via gRPC contracts and Dapr Pub/Sub event meshes, this design delivers sub-50ms P99 latency, isolates database-per-service failures, and automates rollbacks via distributed Saga workflows. 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?” ...

12 tháng 4, 2026 · 11 phút · Lê Tuấn Anh