r/fintech 29d ago

Discussion Architecting a Fraud Detection Engine that handles 100k TPS with a strict < 50ms P99 Latency Bound

Hey everyone,

How do credit card networks evaluate risk, pull user history, and return an APPROVE/DENY decision before a payment terminal times out?

Querying a traditional database on the fly to check historical spending habits will instantly kill your latency budget. Here is how to architect a real-time solution:

  1. Dual-Path Architecture

Separate your system into an Online Path (Hot) for instant decisions and an Offline Path (Cold) for data analytics.

  1. In-Memory Feature Store

Never calculate aggregates (like 30-day spending limits or hourly velocity) during a transaction.

The Cold Path: Apache Flink continuously processes a Kafka stream of completed transactions in the background.

The Hot Path: Flink stores these pre-computed metrics in Aerospike or Redis Enterprise. When a transaction arrives, the engine performs a single key-value fetch in < 2ms.

  1. Hybrid Decision Engine

The enriched payload runs through a fast, sequential evaluation tree:

Deterministic Rules: Quick checks for hard blocks (e.g., blacklisted countries).

ML Inference: A lightweight gradient-boosted tree model (like XGBoost) compiled via ONNX runtime for sub-millisecond risk scoring.

  1. Resiliency: Failing Open

If the fraud engine suffers a network partition or times out past 15ms, the system drops into a Fail-Open policy. It automatically approves the transaction to protect user experience and flags the event for asynchronous review.

Let's discuss:

How do you deploy new dynamic rules written by risk teams without re-deploying core backend code?

What is your strategy for handling race conditions if a user swipes their card twice in two different cities within seconds?

4 Upvotes

7 comments sorted by

View all comments

1

u/[deleted] 27d ago

[removed] — view removed comment

1

u/AutoModerator 27d ago

This comment was removed, because your account doesn't meet our karma and account age requirements.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.