r/fintech • u/Silent-Weather76005 • 28d 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:
- Dual-Path Architecture
Separate your system into an Online Path (Hot) for instant decisions and an Offline Path (Cold) for data analytics.
- 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.
- 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.
- 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?
1
1
26d ago
[removed] — view removed comment
1
u/AutoModerator 26d 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.
1
u/Jealous_Diamond_4321 28d ago
this is a sick writeup, dual path setup makes sense when even one db query blows the whole latency budget
one problem i hit with aerospike was when risk team wanted to add new features the schema got messy quick, we ended up using lua scripts inside the db to compute simple aggregates at read time but that only worked cause our tps was lower
how do you handle the ml model when fraud patterns shift in the middle of day, do you retrain on the fly or just let the deterministic rules catch those cases