Skip to main content
← PROBLEMS / SYSTEM-DESIGN
An end-to-end domain learning journey

Design a Real-Time Financial Fraud
Detection System (<30ms SLA).

Design a mission-critical Real-Time Financial Fraud Detection platform processing 50K payment authorizations/sec under a hard <30ms p99 SLA with zero single points of failure.
Start the journey7 stages· Last modified Nov 24, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When durability and read throughput pull in opposite directions, execute Flink velocity updates, bounded Neo4j/TigerGraph 2-hop queries, and Triton XGBoost+GNN inference in parallel with strict per-hop timeouts.

TL;DR30-second simplified summary
▾

Hitting 50K TPS under 30ms requires parallelizing RocksDB velocity reads with 8ms-capped graph lookups, serving XGBoost+GNN in a single Triton DAG, and micro-batching graph writes.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Streaming Fraud Detection & Graph Ring Scoring
Streaming Fraud Detection & Graph Scoring combines millisecond sliding-window velocity counters with 2-hop entity-ring graph traversal to block payment fraud before funds settle.
Full walkthrough · 7 stages
01
foundation

30ms Latency Budget & Availability Targets.

Why this matters: Allocate millisecond budgets across parallel feature enrichment and scoring.

Think of 30ms Latency Budget & Availability Targets as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Allocate millisecond budgets across parallel feature enrichment and scoring.

At 50K TPS peak (Black Friday), the 30ms p99 budget breaks down into: 3ms Gateway + Auth, 10ms parallel Flink/RocksDB velocity + Graph 2-hop query, 8ms Triton XGBoost+GNN scoring, 4ms Decision Engine + Audit Log, and 5ms network buffer.

SLA Budget

50K TPS & 30ms Parallel Budget

Payment Gateway(3ms)Auth proxyParallel Enrichment(10ms)Feature gatherTriton Server (8ms)ML scorerDecision Engine(4ms)Response gateSends dense vector

1.Parallel Enrichment: Running velocity and graph lookups concurrently saves 8-10ms.

2.99.99% Fail-Open/Safe: On ML timeout, fall back to deterministic rules so good payments proceed.

Parallelizing velocity and graph lookups is essential to fit inside a 30ms authorization window.

02
foundation

Synchronous Scoring & Async Feedback Topology.

Why this matters: Separate the <30ms decision path from durable Kafka state and analyst feedback.

Think of Synchronous Scoring & Async Feedback Topology as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Separate the <30ms decision path from durable Kafka state and analyst feedback.

The Payment Gateway calls the Fraud Decision Service via gRPC while simultaneously publishing the event to Kafka. Flink maintains RocksDB velocity state, Triton scores the transaction, and every decision + analyst override loops back to update blacklists and training lakes.

System Architecture

Sync gRPC Scoring & Async Kafka Feedback

Payment GatewayCheckout callerFlink + RocksDBStream processorNeo4j / TigerGraphGraph storeTriton + DecisionRisk engineQueries 2-hop ring

1.Dual-Path Consistency: Synchronous RPC updates local state while Kafka provides durable replay.

2.Immutable Audit: Every decision logs exact feature values and rule IDs for regulatory compliance.

Concurrent enrichment and Triton inference deliver <30ms decisions while Kafka persists durable state.

Engineering Decision Framework
Problem
How to implement Design a Real-Time Financial Fraud Detection System (<30ms SLA) without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
When durability and read throughput pull in opposite directions, execute Flink velocity updates, bounded Neo4j/TigerGraph 2-hop queries, and Triton XGBoost+GNN inference in parallel with strict per-hop timeouts.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Design a Real-Time Financial Fraud Detection System (<30ms SLA) experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
intermediate

Idempotent Velocity Updates Under Retries.

Why this matters: Prevent network retries from double-counting transaction velocity.

Think of Idempotent Velocity Updates Under Retries as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Prevent network retries from double-counting transaction velocity.

If a Payment Gateway retries a timed-out fraud check, naive velocity counters increment twice, falsely triggering a burst block. Keying updates by a 5-minute idempotency cache of tx_id in RocksDB guarantees each authorization is counted exactly once.

Exactly-Once State

tx_id Deduplicated RocksDB Velocity

Gateway Retry(tx_id)Retry hazard5-Min tx_id CacheIdempotency gateVelocity CountersExact stateConsistent FeatureVecAccurate inputSkips increment if seen

1.Retry Safety: Deduplicating by tx_id prevents false-positive burst blocks during network blips.

2.5-Min TTL: Short TTLs bound the deduplication index size in RocksDB.

tx_id deduplication inside RocksDB ensures network retries never inflate velocity counters.

04
intermediate

Graph Partitioning & Asynchronous Edge Writes.

Why this matters: Keep graph writes from blocking 2-hop read queries at 50K TPS.

Think of Graph Partitioning & Asynchronous Edge Writes as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Keep graph writes from blocking 2-hop read queries at 50K TPS.

Writing new Card->Device edges synchronously during checkout creates lock contention. We serve 2-hop reads from a read-optimized TigerGraph/Neo4j cluster and stream new edges asynchronously via Kafka with a 500ms micro-batch writer.

Graph Scaling

Read-Optimized Graph Pool + Async Edge Writer

Sync Read PoolLow-latency queryKafka Edge StreamWrite buffer500ms Micro-BatchWriterAsync mutator90-Day Edge PruningMemory hygieneUpdates graph state

1.500ms Freshness: Async micro-batches balance write throughput with sub-second ring updates.

2.90-Day Pruning: Aging out old device links keeps the hot graph compact in RAM.

Decoupling synchronous 2-hop reads from micro-batched Kafka edge writes eliminates lock contention.

05
intermediate

Triton Ensemble Serving (XGBoost + GNN).

Why this matters: Run tabular GBDT and Graph Neural Network models together in <8ms.

Think of Triton Ensemble Serving (XGBoost + GNN) as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Run tabular GBDT and Graph Neural Network models together in <8ms.

NVIDIA Triton hosts both the FIL (Forest Inference Library) GPU-accelerated XGBoost model and a quantized PyTorch GNN encoder in a single DAG pipeline, eliminating inter-service serialization overhead and hitting <8ms p99.

Unified Inference

Triton FIL XGBoost + GNN Ensemble DAG

Hydrated FeatureTensorEnsemble inputTriton FIL XGBoostTabular scorerQuantized GNN HeadRelational scorerLogisticMeta-CombinerFinal riskRuns in parallel

1.Zero-Copy DAG: Triton BLS/Ensemble passes tensors in GPU memory without network hops.

2.FIL Speedup: GPU Forest Inference scores 1,000-tree XGBoost ensembles in ~2ms.

Co-hosting XGBoost FIL and GNN models inside Triton eliminates cross-service hops.

06
advanced

Hot-Reloadable DSL Rules & Dynamic Blacklists.

Why this matters: Block active attack signatures across 50K TPS in under 15 seconds.

Think of Hot-Reloadable DSL Rules & Dynamic Blacklists as the intuition layer for Design a Real-Time Financial Fraud Detection System (<30ms SLA): Block active attack signatures across 50K TPS in under 15 seconds.

Fraud analysts need to block a compromised BIN or ASN immediately. A Git/UI-backed Rule Compiler pushes signed bytecode rules and Bloom-filtered entity blacklists via etcd/Kafka to all Decision Engine pods, taking effect in <15 seconds without restarts.

Rapid Response

Signed DSL Rule Hot-Reload Pipeline

Fraud Ops ConsoleAnalyst trigger1M-Tx Dry-Run SimSafety gateEd25519 Signer +PushSecure distributionDecision EnginePodsLive enforcementSigns if FP < 0.5%

1.Dry-Run Guard: Simulating every new rule on 1M historical txs prevents accidental merchant outages.

2.Cryptographic Signing: Ed25519 signatures ensure only authorized rules execute in production.

Dry-run simulation and signed bytecode pushes enable safe sub-15-second rule deployments.

07
advanced

Multi-Region Active-Active Failover.

Why this matters: Maintain 99.99% availability and consistent velocity state across regions.

Payments cannot stop if a cloud region fails.

Active-active regions replicate Kafka velocity events via MirrorMaker2 and sync global blacklists in <2s.

High Availability

Active-Active Multi-Region Fraud Mesh

Region A (Active)Primary processorRegion B (Active)Peer processorAsync State SyncCross-region bus25ms FailoverRouter99.99% SLAUpdates peer state

1.CRDT Blacklists: Conflict-free replicated sets ensure blocks propagate cleanly without split-brain.

2.Autonomous Regions: Each region scores locally without waiting on cross-region synchronous locks.

Autonomous active-active regions with async state replication achieve 99.99% uptime.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

If the Payment Gateway retries a timed-out authorization request, how do you prevent Flink/RocksDB from double-counting the transaction in velocity windows?

Recommended Learning Flow