Saga Pattern: Distributed Transactions Without 2PC

Saga Pattern: Distributed Transactions Without 2PC 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. Pillar Architecture Guide: This article is part of the Architecting 21-Service E-commerce with Golang & DDD series. Please refer to the original article for an architectural overview of the architecture. ...

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

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

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. Parent Architecture Guide: This article is part of our pillar series on Ecommerce Architecture & Composable Migration. 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

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

Event-Driven Microservices in Go: NATS JetStream & CQRS

High-Throughput Event-Driven Microservices in Go with NATS JetStream & CQRS Answer-First: Building high-throughput event-driven microservices with Go, NATS JetStream, and CQRS decouples write commands from read queries. Utilizing NATS JetStream pull consumers, server-side deduplication, and atomic Redis read guards processes 100,000+ transactions per second with sub-0.8ms P99 latencies and zero database write contention. Section 1: Architectural Rationale: Why Go + NATS JetStream for Event-Driven Microservices Scaling distributed systems beyond tens of thousands of transactions per second requires overcoming database write contention and cascading latency spikes inherent in synchronous request-response paradigms. Adopting Command Query Responsibility Segregation paired with event-driven architectures isolates write commands from analytical queries, enabling high-throughput microservices to process state mutations with sub-millisecond latencies. ...

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

Golang Routing Microservices with Kratos & Dapr Framework

Answer-First: High-throughput geospatial microservices in Go leverage H3 spatial indexes, concurrent goroutines, and Protobuf gRPC APIs for real-time ETA calculation. Pillar Architecture Guide: This article is part of the GitOps at Scale: Kubernetes & ArgoCD for Microservices series. Please refer to the original article for a comprehensive overview of the architecture. Prerequisite: Before reading this part, review Part 3: Spatial Indexing. Part 4: Golang API & Microservices Integration (Kratos & Dapr) Executive Summary & Quick Answer: Integrating a high-concurrency Golang API Gateway with a downstream Java routing engine requires robust defense-in-depth patterns: golang.org/x/sync/singleflight for request deduplication, sony/gobreaker circuit breakers for fail-fast isolation, and flattened 1D arrays for Protobuf distance matrix serialization to prevent Go GC pauses. ...

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

Banking Microservices in Go: Saga & Event Sourcing

Banking Microservices in Go: Saga & Event Sourcing Answer-First: Building resilient banking microservices in Go requires replacing monolithic core systems with double-entry ledger immutability, Transactional Outbox patterns via Kafka, and Temporal Saga orchestration. This architectural combination guarantees strict financial consistency, prevents double-spending, and handles transient payment gateway failures gracefully. How to implement transactional outbox pattern to guarantee eventual consistency. Saga Orchestration patterns that handle transient payment gateway timeouts gracefully. 1. Introduction: Deconstructing the Legacy Core For decades, legacy banking platforms like Temenos T24 and Oracle FLEXCUBE served as rigid transactional monoliths designed for batch processing. Modern digital banking architectures in 2026 require decomposing these monolithic bottlenecks into event-driven Go microservices capable of processing real-time payments with sub-10ms latency and high throughput. ...

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

Dapr Workflow Go Tutorial: Orchestrated Saga Pattern

Dapr Workflow Go Tutorial: Orchestrated Saga Pattern Answer-First: Dapr Workflow implements Orchestrated Sagas in Go using replay-based durable execution, where a single orchestrator function owns the entire multi-step transaction lifecycle. It automatically records event history in a state store, surviving process restarts without duplicate execution and executing compensation handlers in sequence if any step fails. Compensation handlers configuration in Dapr to guarantee atomic rollback. How to handle transient workflows when the orchestrator instance restarts mid-transaction. Most Go developers building microservices know the Choreography Saga pattern: service A emits an event, service B reacts, service C reacts to B, and so on. If step C fails, services emit “compensation” events in reverse order. The pattern works elegantly for simple flows, but breaks down as the number of steps grows: debugging a failed saga requires tracing events across five message broker topics, and implementing compensation logic requires every service to understand the full saga’s state. ...

June 1, 2026 · 14 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