Go System Design: CAP, PACELC & Clean Architecture Primer

Prerequisite: This is Part 1 of the System Design Masterclass series. Familiarity with basic distributed systems concepts and Go syntax is assumed. Answer-first: Sound system design thinking is fundamentally about evaluating and selecting trade-offs across performance, reliability, and cost. No system is perfect — architects optimize for the constraints imposed by real business requirements and technical realities. How Do You Build System Design Thinking? Answer-first: System design mastery is built on three pillars: mastering foundational theorems (CAP, PACELC), practicing trade-off analysis on real-world case studies, and repeatedly decomposing large problems into measurable, independently scalable components. ...

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

Tech Radar 17/06: Kratos Clean Architecture & Dapr Pub/Sub

Welcome back to the Tech Radar bulletin. Last week we dissected how Kratos and Dapr v1.15 solve State Collisions via ETags. This week we go one layer deeper: how do you structure the entire codebase so that Kratos, Wire, and Dapr Pub/Sub compose cleanly — and how do you keep that architecture testable, resilient, and production-safe? 1. The Four Layers of Kratos Clean Architecture Answer-first: Kratos enforces a four-layer Clean Architecture — api, service, biz, and data — where business logic in biz is completely isolated from transport and infrastructure. Each layer communicates only with the layer adjacent to it, and only through interfaces. ...

June 17, 2026 · 6 min · Lê Tuấn Anh

Part 8: Zero-Downtime Map Updates & Multi-Region Kubernetes

Writing a fast algorithm is only half the battle. The true test of a Principal Engineer is deploying a massive, stateful Routing Engine to the Cloud without causing a single second of downtime during map updates or infrastructure failures. Answer-first: You cannot treat Graphhopper like a stateless web server. Updating the OpenStreetMap data takes 30 minutes of heavy computation. You MUST decouple the map build process using Kubernetes Jobs, inject the pre-computed 50GB cache via initContainers, and switch traffic instantly using Blue-Green Deployments. ...

June 15, 2026 · 5 min · Lê Tuấn Anh

Part 7: Load Testing and Performance Tuning for Production

Load testing is the final boss of System Design. A junior engineer runs a script, sees “20,000 RPS” with 0 errors, and assumes the system is ready. A Principal Engineer knows that unless you tune the Linux Kernel, bypass Coordinated Omission, and simulate realistic chaos, that number is a complete lie. Answer-first: Load testing a routing engine is not just about testing your Go code. It is a brutal stress test of the Linux Kernel network stack (sockets, TCP reuse, SOMAXCONN), the Go runtime scheduler, and the memory footprint of your load testing tool itself. ...

June 15, 2026 · 4 min · Lê Tuấn Anh

Part 6: Location Clustering with Uber H3 & Redis Semantic Caching

Caching an exact GPS coordinate is impossible. Because floating-point numbers are infinitely precise, two users standing 1 meter apart will have completely different coordinates (106.0001 vs 106.0002). If your Redis key is simply lat1,lng1:lat2,lng2, your Cache Hit Rate will forever remain at 0%. Answer-first: To survive massive scale, you must implement Semantic Caching. Instead of caching raw coordinates, use Uber H3 to “snap” coordinates into 100-meter hexagonal buckets. Your cache key becomes route:{h3_origin}:{h3_dest}. This instantly transforms a compute-heavy routing problem into a lightning-fast Redis memory lookup. ...

June 15, 2026 · 4 min · Lê Tuấn Anh

Part 4: Golang API & Microservices Integration (Kratos & Dapr)

Building a simple API that calls Graphhopper via http.Get is easy. Building a Principal-level API Gateway that survives 10,000 concurrent riders requesting routes without crashing is a masterclass in Distributed Systems. Answer-first: Graphhopper is a heavily CPU-bound downstream service. If your Golang API blindly accepts traffic and forwards it, a slight slowdown in Graphhopper will cause your Goroutines to pile up, exhausting your server’s RAM and triggering a cascading failure. You must implement a “Defense in Depth” strategy using Concurrency Bounding, Circuit Breakers, and Asynchronous Pub/Sub. ...

June 14, 2026 · 4 min · Lê Tuấn Anh

Part 3: Spatial Indexing (Uber H3, PostGIS & Redis GEO)

A fatal mistake made by junior engineers building ride-hailing apps is connecting their API Gateway directly to the Routing Engine. Answer-first: Graphhopper is extremely CPU-intensive. If you ask it to calculate the ETA to all 10,000 drivers currently online in a city, your servers will melt. You must introduce Spatial Indexing (like Uber H3 or Redis GEO) as a high-speed “Pre-filter”. The index quickly finds the 50 closest drivers “as the crow flies” using RAM, and only those 50 are sent to Graphhopper for heavy ETA calculations. ...

June 14, 2026 · 5 min · Lê Tuấn Anh

Tech Radar (14/06/2026): Kratos & Dapr State Management

Welcome back to the Tech Radar bulletin. In modern Microservices architecture, maintaining a system capable of communicating flexibly both externally (HTTP) and internally (gRPC) is an essential requirement. Simultaneously, State Management in distributed environments demands rigorous solutions to prevent data collisions. Today, we will dissect how to combine Go’s highly acclaimed Kratos framework with Dapr v1.15 to comprehensively solve this problem. 1. Kratos Dual-Protocol: HTTP & gRPC Running in Parallel Answer-first: The Kratos framework integrates with Dapr v1.15 State Management via the sidecar pattern, allowing HTTP and gRPC servers to run concurrently. To avoid state collisions when running dual-protocol, the system uses Dapr ETags via SaveStateWithETag for Optimistic Concurrency Control, and uses Middleware for Metadata synchronization. ...

June 14, 2026 · 4 min · Lê Tuấn Anh

Tech Radar (13/06/2026): Go 1.26 GC, K8s Pod Resizing & AI-Native

Welcome back to the Tech Radar bulletin, where we filter out the noise of the tech industry to uncover the genuine trends shaping future System Architecture. The second week of June 2026 witnessed three massive shifts, from core infrastructure (Go, Kubernetes) to the maturation of AI-Native architecture. From the perspective of a System Architect, these are updates you cannot ignore to optimize your High-Concurrency systems. 1. Golang 1.26: “Green Tea” GC Architecture - The Savior for RAM-Hungry Microservices Enabled by default in Go 1.26, the Garbage Collector codenamed “Green Tea” is not just a performance patch; it is a core architectural overhaul. ...

June 13, 2026 · 4 min · Lê Tuấn Anh

Chapter 1: How Systems Handle Millions of Requests/s (C10M)? Lessons from Shopee & Alipay

← Series hub Next → Chapter 1: Overcoming the C10M Barrier To build a system capable of handling millions of Requests Per Second (RPS) — known as the C10M problem — vertical scaling is never enough. It requires a meticulously designed Distributed Architecture. 1. The Shift from C10K to C10M Answer-first: While C10K was solved by non-blocking I/O (like NGINX), C10M shifts the bottleneck to the OS kernel. Systems must bypass the kernel using DPDK or XDP to handle 10 million connections efficiently. ...

June 9, 2026 · 3 min · Lê Tuấn Anh

The Reality of C10M: Surviving Extreme Traffic — Exec Summary

Despite the massive advancements in cloud computing, enterprise applications facing explosive traffic growth inevitably hit a brutal wall: the Database and the Network layer. The root cause lies not in the hardware, but in the Architecture. We attempt to solve the “Millions of Requests per Second” (C10M) problem by simply throwing more servers at it (Vertical/Horizontal Scaling), only to realize that stateful bottlenecks, cache stampedes, and dual-write inconsistencies bring the entire cluster to its knees. ...

June 9, 2026 · 3 min · Lê Tuấn Anh

Real-Time Inventory: Kafka, CDC & Redis for E-Commerce

Answer-first: Attempting to simultaneously write inventory updates to a fast cache (Redis) and a relational database (PostgreSQL) creates the dual-write problem. If one system fails, data diverges. Furthermore, synchronous SELECT FOR UPDATE queries in SQL cause massive lock queues and API timeouts. What You’ll Learn That AI Won’t Tell You Write-through caches configuration in Redis to prevent inventory drift. Lua scripting implementations in Redis that prevent double-reservations under peak load. What Is Real-Time Inventory Synchronization? Real-time inventory synchronization is the process of propagating stock count changes from the system of record (database) to all sales channels — web storefront, mobile app, WMS, ERP — in sub-second time. Instead of batch ETL jobs that run every hour, a CDC + Kafka pipeline streams every committed stock change as an event, eliminating overselling and stale stock displays. ...

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

Real-Time Ride-Hailing Architecture: Uber & Grab Stack

Answer-first: Ride-hailing architectures ingest millions of GPS pings per second using Uber’s H3 spatial index for geofencing. Kafka streams location updates to matching engines for driver allocation, while Flink processes real-time pricing and push gateways notify users. What You’ll Learn That AI Won’t Tell You Scaling matching engines to millions of geographic updates using H3 indexing. Designing low-latency push notification gateways to dispatch driver routes. The moment you open the Uber or Grab app, a cascade of real-time systems activates simultaneously: your phone begins transmitting GPS coordinates, a geospatial index updates your location, a matching engine re-evaluates nearby driver availability, a pricing model recalculates the fare based on supply-demand ratios, and a push notification pipeline prepares to deliver your match confirmation in under 3 seconds. ...

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

Microfinance Core Banking: Architecture & Engineering Guide

Answer-first: Microfinance core banking requires a decentralized architecture: a double-entry ledger for transaction auditing, a joint liability group (JLG) loan engine with optimistic concurrency controls, modular interest/amortization processors, and parallelized worker pools to handle heavy End-of-Day batch processing. What You’ll Learn That AI Won’t Tell You How to prevent phantom funds in double-entry ledgers by writing strict write-once, append-only transaction logs. Optimistic concurrency control implementations using version-checks and SELECT ... FOR UPDATE that survived concurrent interest calculations on 50,000 active accounts. Building a Core Banking System (CBS) for a Microfinance Institution (MFI) presents a radically different set of engineering challenges compared to traditional retail banking. While commercial banks focus heavily on individual credit scores and card networks, microfinance operates on high-frequency, low-value transactions, group-based lending, and offline field collections. ...

May 27, 2026 · 8 min · Lê Tuấn Anh

Autonomous Hybrid-AI Pipeline: Cron to State-Machine

Answer-first: Transition from fragile, expensive cron jobs to a resilient, state-based Finite State Machine (FSM) for autonomous content pipelines. Dramatically reduce LLM API fees by employing a tiered hybrid routing strategy—using local models for routing and frontier models only for editing—and implement Wake-on-LAN to control GPU server utility costs. What You’ll Learn That AI Won’t Tell You How to structure MinHash thresholds to filter out syndicated duplicates without dropping minor updates in high-frequency feeds. A complete breakdown of Wake-on-LAN (WOL) sleep scheduling that cut local GPU server idle power consumption by 92% in production. It’s easy to write a cron job that pings an API, hands a URL to OpenAI, and publishes a markdown file. It’s significantly harder to orchestrate a distributed swarm of AI agents that can read deeply from diverse sources, deduplicate state across time, evaluate article quality through a multi-layer gate, safely publish via GitOps, and optimize its own power footprint—all without human intervention. ...

May 18, 2026 · 14 min · Lê Tuấn Anh

LeaseInVietnam: AI-Powered Expat Rental & B2B Lead Engine

Answer-first: LeaseInVietnam runs an autonomous AI pipeline that ingests, cleans, and translates rental listings. By extracting structured property attributes using LLM-based schemas, it converts raw data into high-value expat guides and property listings, serving as a high-converting B2B lead generation engine. What You’ll Learn That AI Won’t Tell You Structuring scrapers to bypass IP blocks while parsing rental data. Using LLMs to standardize unstructured rental locations into precise lat-long values. Most AI content projects are built around one question: how do I publish more? LeaseInVietnam is built around a different question: how do I make every published piece convert? ...

April 24, 2026 · 14 min · Lê Tuấn Anh

Migrating Magento to Microservices: When & Why

Answer-first: Migrate from Magento’s monolithic EAV architecture to microservices when database locks during checkout, slow page speed, and deployment coupling block business growth. A headless, API-first approach decouples checkout and catalog, improving latency and developer agility. What You’ll Learn That AI Won’t Tell You Latency improvement metrics for headless checkout over monoliths. Breaking up tight database foreign keys to isolate microservice storage domains. Let’s be direct: Magento is not a bad platform. For thousands of businesses, it is the right tool. It has a mature plugin ecosystem, a large developer community, and a proven track record across enterprise e-commerce. ...

April 14, 2026 · 13 min · Lê Tuấn Anh

Zero-Downtime: Moving from Magento to Microservices

Answer-first: Migrate a complex Magento monolith to microservices without downtime by utilizing a 3-Phase Strangler Fig pattern. Stream legacy updates to Go microservices in real time using Debezium CDC, manage bidirectional synchronizations using Dapr Pub/Sub to maintain eventual consistency, and keep Magento as a 30-day hot standby for instant rollback capability. What You’ll Learn That AI Won’t Tell You Decoupling cart and checkout tables from Magento core databases. Data synchronization pipelines that prevent order loss during checkout transitions. “Let’s rewrite everything to Microservices.” ...

April 14, 2026 · 14 min · Lê Tuấn Anh

Architecting 21-Service E-commerce with Golang & DDD

Answer-first: We decompose the monolith into 21 microservices using Domain-Driven Design (DDD) to isolate business boundaries. Implementing the Kratos framework in Go enables strong structural subtyping for clean layer segregation, while Dapr Workflows handle distributed transactions asynchronously via the Saga pattern to avoid race conditions. What You’ll Learn That AI Won’t Tell You The exact performance overhead of using Go’s structural subtyping versus manual dependency injection in high-throughput microservices. Why scoping database transactions to a single Aggregate root is critical, and how we resolved out-of-order event delivery using Kafka partition keys. Scaling an e-commerce platform past 10,000+ orders per day containing multiple SKUs across dynamic warehouses is where naive architecture breaks down. Hardware scaling ceases to be a magic bullet when distributed transactions, race conditions, and eventual consistency are involved. ...

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

Deconstructing the Ecosystem: Service Details by Domain

Answer-first: We partition the e-commerce domain into six logical business domains—Identity, Catalog, Cart, Checkout, Order, and Fulfillment—containing 21 isolated services. Each service owns its database exclusively, communicating asynchronously via event brokers to ensure scalability and prevent tight coupling. What You’ll Learn That AI Won’t Tell You Why microservices must own their schema migrations (via Golang-Migrate) independently, and the specific event schemas that prevent transactional coupling. Real-world database deadlocks encountered when segregating order history from the catalog database, and how they were solved using CQRS. “Why 21 services? Isn’t that overkill?” ...

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