Executive Summary: Geospatial & Routing Architecture

Prerequisite: This is the executive summary and introductory overview of the Routing & Geospatial Architecture series. No prior reading is required to start here. Executive Summary: Geospatial & Routing Architecture Answer-first: High-concurrency routing systems combine Java-based GraphHopper engines for Contraction Hierarchies pathfinding with a Golang API Gateway using Uber H3 hexagonal indexing and Redis semantic caching. This architecture resolves 100x100 distance matrices in under 30ms while reducing compute load by up to 95%. ...

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

High Concurrency System Design Architecture in Go

Prerequisite: Familiarity with the concepts introduced in Executive Summary. Review it first if the terminology in this part is unfamiliar. Answer-first: Handling millions of requests per second (the C10M problem) requires eliminating kernel-space context switching overhead through asynchronous event loops (epoll/kqueue) or kernel-bypass networking (DPDK, io_uring), paired with zero-copy I/O memory buffers, L4 DSR (Direct Server Return) load balancing, and lock-free concurrency structures in Go. flowchart TD Client[Client Traffic Millions req/sec] --> L4[L4 Maglev LB / DPDK DSR] L4 --> L7 Envoy1[L7 Gateway / Envoy Node 1] L4 --> L7 Envoy2[L7 Gateway / Envoy Node 2] subgraph Core Engine [Go High-Concurrency Engine] L7 Envoy1 --> Netpoll[epoll / io_uring Event Loop] Netpoll --> LockFreeQ[Lock-Free Ring Buffer Worker Pool] LockFreeQ --> ZeroCopy[Zero-Copy Memory Allocator sync.Pool] ZeroCopy --> DB[(TiDB / Redis Cluster)] end 1. The Physics of High Concurrency: Beyond C10K to C10M When modern e-commerce platforms like Shopee run Flash Sales or fintech engines like Alipay process Double 11 peak traffic, request rates spike from normal operations (50,000 req/sec) to over 10,000,000 requests per second within milliseconds. ...

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

Double-Entry Bookkeeping: Core Banking Ledger Guide

Answer-first: Double-entry bookkeeping in core banking guarantees that every transaction records equal Debit and Credit entries across sub-ledgers. Enforcing $\sum \text{Debits} = \sum \text{Credits}$ at the database schema level via atomic PostgreSQL transactions and Go ledger validation engines prevents financial imbalance, race conditions, and audit compliance failures. Prerequisite: Read the Executive Summary for the high-level roadmap of core banking evolution. Why does a developer need to learn accounting? Answer-first: Developers must understand accounting principles to design software ledgers that correctly enforce balance invariants and immutable journal logs. ...

May 6, 2026 · 11 min · Lê Tuấn Anh

PayPay Microservices: GitOps & Kubernetes Blueprint

Prerequisite: This is the starting part of the series — no prior part is required. Later parts assume the concepts introduced here. Answer-first: PayPay scales over 100 microservices for 60+ million users in Japan by combining Domain-Driven Design boundaries with GitOps CD automation using ArgoCD and Argo Rollouts. Automated canary deployments validate new code against live production metrics before full traffic shifting. Answer-first: PayPay enforces stable deployments by combining branch promotion workflows with GitOps tools like ArgoCD. Declarative configuration files in git serve as the single source of truth, allowing ArgoCD to automatically reconcile cluster state, execute canary rollouts, and enable instant rollbacks of microservices. ...

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

Event Sourcing & CQRS: Immutable Ledger for Microservices

Prerequisite: Familiarity with the concepts introduced in Part 2 — Distributed Sql Acid Latency. Review it first if the terminology in this part is unfamiliar. Answer-first: Event sourcing and CQRS replace mutable database updates with an immutable append-only event log. Core banking systems record financial state changes as domain events, projecting read models asynchronously while guaranteeing auditability and zero data loss. Series (Part 3 of 8): This article builds upon the ACID transactions foundation from Part 2. We will design a ledger using Event Sourcing — the exact solution that Monzo, Starling Bank, and many large neo-banks use to scale. ...

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

Core Banking Domain Modeling: CIF, CASA & Lending Guide

Answer-first: Core banking domain architecture revolves around three sub-systems: Customer Information File (CIF) for identity and KYC, Current & Savings Accounts (CASA) for real-time deposit ledgers, and Lending for loan amortization. Isolating these bounded contexts in Go microservices prevents cascading database lock contention during End-of-Day interest calculation batch jobs. Prerequisite: Part 1: Double-Entry Ledger Schema Design on standard accounting invariants. Overview of the Three Core Modules Answer-first: The three foundational core banking modules are Customer Information File (CIF), CASA deposit accounts, and Lending credit operations. ...

May 6, 2026 · 13 min · Lê Tuấn Anh

PayPay Event-Driven Architecture: Kafka at Scale

Prerequisite: Familiarity with the concepts introduced in Part 1 — Microservices Gitops. Review it first if the terminology in this part is unfamiliar. Answer-first: Managing transaction surges during PayPay’s massive marketing campaigns requires event-driven architecture powered by Apache Kafka. Partition key tuning, Go consumer worker pools, and channel-based backpressure prevent message loss during peak traffic spikes. Answer-first: PayPay builds a decoupled microservices network by streaming transactions asynchronously via Apache Kafka. To ensure financial safety, consumers process events using idempotency keys tracked in distributed caches, preventing duplicate ledger entries or double-spend occurrences in the event of retries or network partition splits. ...

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

Saga Pattern: Distributed Transactions Without 2PC

Prerequisite: Familiarity with the concepts introduced in Part 3 — Event Sourcing Cqrs. Review it first if the terminology in this part is unfamiliar. Answer-first: The Saga pattern coordinates distributed transactions across core banking microservices without two-phase commit (2PC). By executing local transactions and defining compensating actions for failures, Sagas ensure eventual consistency across payment and ledger services. Series (Part 4 of 8): This article builds upon Event Sourcing from Part 3. The Saga Pattern solves the problem: “How do we ensure consistency when a transaction must coordinate across multiple microservices without using distributed locks or 2PC?” ...

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

Qdrant Hybrid Search: Solving Semantic and Hard Filters

Prerequisite: Familiarity with the concepts introduced in Part 2 — Ingestion Chunking. Review it first if the terminology in this part is unfamiliar. In Part 2: Data Ingestion & Atomic Chunking - Bringing Product Data into the AI Environment, we established a clean data synchronization pipeline from PostgreSQL to Qdrant via Kafka CDC. But the journey of building a standard e-commerce search engine has just begun. When a user enters: “Asus ROG Zephyrus G14 laptop under $1500 in stock” ...

May 22, 2026 · 7 min · Lê Tuấn Anh

Part 4: gRPC Internal & REST Gateway: API Contract Lifecycle

Prerequisite: This is the starting part of the series — no prior part is required. Later parts assume the concepts introduced here. Answer-first: Combining internal gRPC transport with an automated REST JSON Gateway (grpc-gateway) provides sub-millisecond HTTP/2 inter-service RPC performance while exposing standard OpenAPI/REST endpoints to web/mobile clients, guaranteed through Protocol Buffer contract linting and backward-compatible schema versioning. The sequence diagram below illustrates the end-to-end request lifecycle as an external REST/JSON HTTP client payload is transcoded by the API Gateway into high-performance gRPC Protobuf binary calls across internal microservices. ...

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

ACID Transactions & Isolation Levels in Core Banking

Answer-first: Enforcing ACID isolation levels in core banking prevents lost updates and dirty reads during high-concurrency transfers. Using PostgreSQL REPEATABLE READ or pessimistic row locking (SELECT FOR UPDATE) combined with Go connection pooling guarantees transactional integrity. Spanner and CockroachDB provide linearizable distributed ACID transactions across microservices using Paxos consensus and Hybrid Logical Clocks. Prerequisite: Part 2: CASA & Lending Domain Logic on transaction parameters. The Core Problem: Concurrency Answer-first: High-concurrency banking transfers risking race conditions and lost updates require strict database lock isolation to protect ledger state. ...

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

ISO 20022 pacs.008: Parse, Idempotency & Gateway Latency

Prerequisite: Familiarity with the concepts introduced in Part 4 — Saga Pattern. Review it first if the terminology in this part is unfamiliar. Answer-first: ISO 20022 MX messages (pacs.008, pacs.009, camt.053) replace legacy ISO 8583 text formats with structured XML/JSON schemas. Production payment gateways validate MX payloads, ensure idempotency, and translate ISO messages to internal ledger events. Series (Part 5 of 8): After designing Saga patterns in Part 4, this article covers the international integration layer — where the Core Banking system communicates with the external financial world via the ISO 20022 standard. ...

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

Active RAG & Strict Tool Calling With Real-time APIs

Prerequisite: Familiarity with the concepts introduced in Part 3 — Qdrant Hybrid Search. Review it first if the terminology in this part is unfamiliar. In Part 3: Qdrant Hybrid Search - Solving Semantic and Hard Filters, we successfully built a powerful Hybrid search engine combining Dense Semantic and Sparse Lexical Search. However, a practical e-commerce search system goes far beyond merely retrieving static documents from a vector database. For example, a user asks: “I want to buy a 400L Samsung Inverter refrigerator available at the District 1 branch that has an active promotion.” If we rely solely on a Vector Database, we face two critical errors: ...

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

Banking Microservices Architecture: Event Sourcing & Saga

Answer-first: Modernizing core banking monoliths requires transitioning to event-driven microservices using Event Sourcing, CQRS, and the Saga Pattern. Emitting immutable domain events for every ledger mutation enables decoupled scaling, complete financial auditability, and sub-millisecond query responses across composable banking modules. Prerequisite: Part 3: Transaction Isolation and ACID Guarantees on database lock behaviors. Series context (Part 4 of 8): This guide assumes familiarity with ACID transactions and database concurrency. Understanding why consistency guarantees are hard at the database layer is essential context before introducing distributed patterns here. ...

May 6, 2026 · 12 min · Lê Tuấn Anh

Critique Loop Architecture: Preventing LLM Hallucination

Prerequisite: Familiarity with the concepts introduced in Part 4 — Active Rag Tool Calling. Review it first if the terminology in this part is unfamiliar. In Part 4: Active RAG & Strict Tool Calling - Connecting LLMs to Real-time APIs, we successfully built a cyclic ReAct graph allowing the LLM to call APIs to check inventory and promotions in real-time. However, in a real-world production environment, giving an LLM access to Tools is not enough to guarantee absolute accuracy. ...

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

Part 5: ISO 8583 & ISO 20022 Core Banking Standards

Answer-first: Integrating legacy ATM/POS networks (ISO 8583 bitmap protocols) with modern real-time gross settlement systems (ISO 20022 XML/pacs.008 and pacs.009 schemas) requires high-performance Go parser pipelines. In-memory bitwise parsing ensures sub-5ms message translation across payment gateways while preserving full financial audit trails. Prerequisite: Part 4: Modern Event-Driven Core Architecture on event-sourcing structures. Why are international standards important? Answer-first: International messaging standards ensure interoperability across global banking networks, card acquirers, and central bank clearing systems. ...

May 6, 2026 · 10 min · Lê Tuấn Anh

PayPay Campaign Engine: Peak Sales & Wallet Rewards

Prerequisite: Familiarity with the concepts introduced in Part 4 — Sre Chaos Engineering. Review it first if the terminology in this part is unfamiliar. Answer-first: Scaling for billion-yen cashback campaigns requires pre-warmed Redis cluster caching, token-bucket rate limiting at the API gateway, and async queue-based payment processing to shave peak traffic spikes. Answer-first: The PayPay campaign architecture isolates high-throughput reward campaigns from core payment processing. By evaluating campaign eligibility out-of-band and writing reward points asynchronously using event queues, PayPay prevents promotional traffic spikes from impacting critical credit card processing pipelines. ...

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

Production Agentic Search Engine Optimization in Golang

Prerequisite: Familiarity with the concepts introduced in Part 5 — Critique Loop. Review it first if the terminology in this part is unfamiliar. In Part 5: Critique Loop - Preventing LLM Hallucination, we successfully built an automated response auditing module to ensure logical accuracy. However, when deploying this Agentic Search system to a large-scale production environment serving millions of users, you will immediately face practical operational challenges: Unit Economics: Every user search going through multiple LLM calls (from generating answers, calling tools, to self-critiquing) will skyrocket API bills. Latency: Customers won’t patiently wait 5-10 seconds to receive the complete final answer. Observability: How do you trace which nodes a request went through, how many tokens it consumed, and where it encountered errors? This guide addresses these operational challenges by integrating Semantic Caching (Redis), Deterministic Model Routing, Server-Sent Events (SSE) Streaming, and OpenTelemetry Tracing into the Eino (CloudWeGo) framework. ...

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

Part 6: Core Banking Security, PCI-DSS & Audit Trails

Answer-first: Core banking security mandates zero-trust architecture, hardware security module (HSM) key management, mTLS 1.3, field-level AES-256-GCM encryption for customer PII, and tamper-evident append-only audit logs. Adhering to PCI-DSS v4.0 and SOC 2 Type II controls ensures transaction privacy, immutable balance records, and strict regulatory compliance without compromising transactional throughput. Prerequisite: Part 5: ISO 8583 & ISO 20022 Messaging on message translation layers. Why is Core Banking Security Different? Answer-first: Banking security requires strict zero-trust access, hardware security modules (HSM), immutable audit trails, and compliance with PCI-DSS and AML regulations. ...

May 6, 2026 · 13 min · Lê Tuấn Anh

PayPay AI Platform: Machine Learning & Fraud Engine

Prerequisite: Familiarity with the concepts introduced in Part 5 — Campaign Architecture. Review it first if the terminology in this part is unfamiliar. Answer-first: Integrating AI capabilities into payment platforms involves embedding real-time LLM RAG hubs for customer support and ML fraud detection models into transaction evaluation pipelines, enforcing sub-20ms model inference SLAs. Answer-first: PayPay integrates AI into its transaction pipelines by streaming payment events asynchronously to machine learning scoring models. Running inference out-of-band prevents risk assessment evaluations from adding latency to the synchronous checkout flow, enabling real-time fraud detection and dynamic credit scoring. ...

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

Build a Mini Core Banking System in Golang Engine Guide

Part 7: Build a Mini Core Banking System in Go Answer-first: Building a production-grade mini core banking system in Go requires implementing an immutable double-entry ledger schema, deterministic row locking to prevent deadlocks, idempotent API handlers, and automated balance invariant reconciliation. This hands-on project validates transaction atomicity, sub-10ms transfer latency, zero-balance corruption, and at-least-once outbox event streaming under high concurrent load. Prerequisite: Part 6: Security, Compliance, and Audit Trails on audit ledger logs. ...

May 6, 2026 · 12 min · Lê Tuấn Anh

Transactional Outbox & Saga Pattern for E-commerce

Prerequisite: Familiarity with the concepts introduced in Part 8 — Phase3 Full Cutover. Review it first if the terminology in this part is unfamiliar. Answer-first: Distributed transaction consistency is achieved using a choreography-based saga paired with a PostgreSQL transactional outbox. Business mutations write to the outbox atomically. Background workers publish events to Dapr PubSub every 500ms, while idempotent consumer handlers process compensation events on failure. When a customer places an order on the Composable Commerce Platform, seven events need to happen in sequence across four independent services: Order created → Payment authorized → Stock reserved → Fulfillment triggered → Notification sent → Loyalty points awarded → Shipping label generated. Any of these can fail. The network can fail. The database can fail. A third-party payment gateway can time out. ...

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

Composable Commerce Architecture Decision Records Guide

Prerequisite: Familiarity with the concepts introduced in Part 9 — Outbox Saga. Review it first if the terminology in this part is unfamiliar. Answer-first: Architectural Decision Records (ADRs) enforce three core principles: resilience over simplicity, strict layer standardization, and explicit event-driven boundaries. Standardizing service layouts, outbox patterns, and database migrations before writing code ensures consistent microservices governance across large engineering teams. 21 services. 24 decisions. 3.5 months of deliberation captured in Architecture Decision Records. ...

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

Warehouse Picker Routing: GraphHopper, OR-Tools & C++

Warehouse Picker Routing Optimization (GraphHopper & OR-Tools) Answer-first: Minimizing walking distance for warehouse pickers requires solving the Traveling Salesperson Problem (TSP) inside a physical building. The 2026 standard architecture uses a Java-based Indoor GraphHopper instance to generate a 100x100 Distance Matrix from custom OpenStreetMap (OSM) data, which is then fed into a C++ Google OR-Tools gRPC Microservice to calculate the absolute optimal pick sequence in under 15 milliseconds. The S-Shape Trap in Warehouse Picking In legacy Warehouse Management Systems (WMS), workers are directed to pick items using heuristic patterns like the S-Shape (Z-pattern) or Largest Gap. These heuristics force the worker to walk down every aisle that contains an item, traversing the aisle from end to end. ...

August 1, 2026 · 5 min · Lê Tuấn Anh

Order Splitting Algorithm: Graph Coloring & OPA in Golang

Order Splitting at Scale: Graph Coloring, Bin Packing, and OPA in Go Answer-first: Real-time e-commerce order splitting is a Constraint Satisfaction Problem (CSP). To determine the absolute minimum number of cardboard boxes required for a complex cart without violating safety rules or physical dimensions, the 2026 standard pipeline relies on Open Policy Agent (OPA) for dynamic business rules, Golang (gonum) for Graph Coloring (Welsh-Powell) to resolve logical conflicts, and First-Fit Decreasing Bin Packing to resolve physical constraints. This pipeline executes in under 50ms during synchronous checkout, deferring heavy Multi-Warehouse routing to async workers. ...

August 1, 2026 · 5 min · Lê Tuấn Anh

Building a Custom Go Vector DB Engine with HNSW & SIMD

Building a Custom Golang Vector Database Engine with HNSW Building a custom Go vector database engine with HNSW combines 256-bit SIMD AVX2 loop unrolling, off-heap mmap zero-GC slab memory, and Product Quantization (PQ-32) to get high recall at low latency while cutting vector RAM footprint dramatically. This post covers: How to bypass Go bounds checking and force AVX2 vectorization in pure Go using unsafe.Pointer loop unrolling without assembly maintenance overhead. Why naive Go pointer-based graph data structures trigger catastrophic GC pause spikes at 1M+ vectors—and how mmap off-heap slab allocation solves it. How to implement Asymmetric Distance Computation (ADC) lookup tables for Product Quantization to evaluate distance in $O(m)$ byte additions instead of $O(d)$ floating-point multiplications. Fine-grained lockless graph traversal strategies using atomic.Pointer to achieve concurrent write/read throughput without lock contention on high-degree node layers. 1. Vector Search Mathematics & Why Go Needs a Native Engine Modern Artificial Intelligence applications—from retrieval-augmented generation (RAG) to multimodal recommendation systems—depend fundamentally on high-dimensional vector search. Vectors represent semantic embeddings generated by neural networks (e.g., OpenAI text-embedding-3-large at 1,536 dimensions or Cohere embed-v3 at 768 dimensions). Searching for contextually relevant data requires discovering the $k$-Nearest Neighbors ($k$-NN) of a target query vector $\mathbf{q}$ within a dataset $S$ of $N$ vectors. ...

July 23, 2026 · 28 min · Lê Tuấn Anh

Distributed Transactions in Go with Temporal Saga Pattern

Distributed Transactions in Go with Temporal Saga Pattern Distributed transactions in Go microservices are commonly implemented using the Temporal Saga pattern: replacing blocking Two-Phase Commit (2PC) locks with imperative workflow orchestration, dynamic reverse compensations (saga.AddCompensation), and PostgreSQL idempotency tables to keep financial event consistency during network partitions. This guide covers: The Zombie Activity Pitfall: Why setting StartToCloseTimeout without database-level idempotency locks causes phantom debits during prolonged TCP network partitions. Dynamic Compensation Registration: How to structure workflow.NewSaga in Go so that partial failures (e.g., debit succeeds, fraud check passes, but ledger credit fails) only execute compensation for steps that actually mutated state. Handling Non-Compensable External Side-Effects: Practical design patterns for handling third-party banking APIs (e.g., SWIFT/ACH wires) that cannot be programmatically rolled back. Workflow Determinism Invariants: How to write Go workflows that use Temporal signals and queries without triggering fatal non-deterministic replay panic errors. Section 1: FinTech Distributed Transaction Mechanics: 2PC vs Saga & Dual-Entry Accounting Invariants In modern distributed financial systems, microservice architectures decompose monoliths into autonomous domains: Account Management, Fraud Detection, Core Ledger, Payment Gateway Integration, and Customer Notifications. While this decomposition provides organizational velocity and independent database scaling, it shatters the traditional ACID guarantees provided by single-instance relational databases. ...

July 23, 2026 · 23 min · Lê Tuấn Anh

Zero-Trust Service Mesh Security in Go: SPIFFE/SPIRE & Istio

Zero-Trust Service Mesh Security in Go: SPIFFE/SPIRE & Istio Introduction: The Zero-Trust Imperative in Modern Financial Microservices Traditional perimeter security models relying on firewalls, Virtual Private Clouds, and static IP addresses fail to protect modern microservices processing sensitive payment data. Container IP addresses are ephemeral and static Kubernetes secrets risk exposure, so enterprise financial architectures need Zero-Trust models that cryptographically authenticate every inter-service communication. The Payment Card Industry Data Security Standard version 4.0 (PCI-DSS 4.0) explicitly mandates stricter access controls, continuous identity attestation, automated key rotation, and cryptographic verification of all system components accessing the Cardholder Data Environment (CDE). Meeting these requirements demands a shift to a Zero-Trust Architecture (ZTA), where network locality confers zero trust: every service request must be explicitly authenticated, authorized based on strong workload identity, and encrypted in transit using short-lived cryptographic credentials. ...

July 23, 2026 · 19 min · Lê Tuấn Anh

Laravel vs Golang: When to Add Features in Each?

Laravel vs Golang: When to Add Features in Each? This post is part of the Magento to Go Migration series — a CTO playbook for migrating with a Vietnam engineering team. The Real Question Every Tech Lead eventually faces a pivotal architectural dilemma: “Do we add this new feature directly to Laravel, or is this the right moment to introduce a dedicated Golang microservice?” The answer is rarely a simple choice between “Laravel is better” or “Go is better.” Instead, making the right engineering decision requires evaluating the specific operational profile of the feature you are building. High-velocity CRUD features, admin tools, and complex business workflows belong in Laravel. Conversely, real-time WebSocket feeds, high-throughput auth validation, and compute-heavy pipelines belong in Go. ...

July 19, 2026 · 10 min · Lê Tuấn Anh

Magento Migration: Shared DB, CDC, or Event Bus?

Magento Migration: Shared DB, CDC, or Event Bus? Why Go running against Magento’s MySQL is faster at the compute layer but still bottlenecked at the EAV query layer — and what actually fixes it. The single deciding factor between CDC (Option B) and Event Bus (Option C): who owns the PHP Magento codebase. This post is part of the Composable Commerce Migration series — a step-by-step playbook for migrating Magento 2 to Go microservices. For the full migration execution guide, see Part 6: Phase 1 Strangler Fig. ...

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