Ditch Kafka for Nigerian FinTech Core Banking: Why Postgres FOR UPDATE SKIP LOCKED Outperforms Event Streams Under 10,000 TPS
Distributed event streams like Apache Kafka add catastrophic operational overhead and dual-write consistency bugs to mid-scale fintech apps. PostgreSQL with FOR UPDATE SKIP LOCKED provides bulletproof transactional queues without leaving your relational database.
Every technical founder and staff engineer building financial infrastructure in Lagos eventually falls into the distributed systems trap. You read an engineering blog post from Uber or DoorDash explaining how they process millions of events per second with Apache Kafka, and you immediately assume your new fintech app needs a event-driven microservices architecture with Kafka, Zookeeper or Kraft, and a web of decoupled event consumers.
Two months after launch, reality hits. Your database state and Kafka topics drift out of sync during an AWS eu-west-1 network blip. A payment webhook updates a balance in Postgres, but the message publish to Kafka fails due to a network timeout. Now your ledger database says the user has ₦50,000, while your downstream notification engine and risk service think the account is empty. You spend your weekends writing ad-hoc reconciliation scripts to clean up orphaned messages.
At Neobot Tech, we have audited and rebuilt core backend architecture for dozens of African platforms. Our stance is straightforward: unless you are processing more than 50,000 un-ordered write operations per second across multi-region datacenters, putting Kafka in your core transaction flow is an architectural mistake. PostgreSQL using SELECT ... FOR UPDATE SKIP LOCKED is faster to ship, vastly cheaper to operate, and eliminates the dual-write problem by design.
The Dual-Write Disaster in FinTech Ledgers
When engineers introduce an external queue like Kafka or RabbitMQ alongside a relational database, they almost always create a dual-write problem. Consider a standard wallet debit operation. Your code needs to perform two actions:
- Update the ledger entry in PostgreSQL (
UPDATE balances SET balance = balance - 10000 WHERE user_id = 42). - Publish a
WalletDebitedevent to a message broker so async workers can send push notifications, process partner commissions, or trigger AML checks.
Here is the issue: you cannot execute a Postgres SQL transaction and an HTTP/TCP message publish inside a single atomic operation across two separate distributed systems. If you write to Postgres first and publish to Kafka second, the database commit can succeed while the network call to your Kafka broker times out. Your database state has changed, but your event stream never recorded it.
If you flip the order—publishing to Kafka first and committing to Postgres second—your Kafka consumer might read the message and execute worker logic before the Postgres transaction finishes committing. The consumer queries the DB, finds no balance change, and throws a record-not-found exception.
[Client Request]
│
▼
[HTTP Handler]
│
├─► 1. BEGIN DB Transaction ──► [Postgres] (Succeeds)
│
├─► 2. Publish Event ─────────► [Kafka Broker] (FAILS: Network Timeout)
│
└─► 3. COMMIT DB Transaction ─► [Postgres] (Data now out of sync!)
Some engineering teams attempt to fix this with complex distributed transaction patterns like Two-Phase Commit (2PC) or Sagas. Others attempt to use BullMQ vs Temporal vs AWS Step Functions: Architecting 72-Hour Payment Retries for Flaky Nigerian Bank APIs to manage stateful orchestration. While background task runners are excellent for long-running retries, using distributed message brokers for core balance processing in high-concurrency environments introduces unnecessary failure points.
When network latency between your application servers and database spikes during peak hours, Kafka consumer group rebalances freeze message processing. Suddenly, debit events sit in partitions while users pull to refresh their mobile screens, panicking when their wallet balance does not update.
Performance Benchmark: Postgres SKIP LOCKED vs Kafka
Many architects reject PostgreSQL as a queue because they remember historical locking issues. In early database engines, selecting rows for processing locked entire table indexes or blocked readers, leading to lock contention storms.
PostgreSQL 9.5 changed everything with the introduction of SKIP LOCKED. When a worker process requests rows using SELECT ... FOR UPDATE SKIP LOCKED, PostgreSQL scans the index, locks the matching rows that are free, and completely skips any rows currently locked by another concurrent transaction. Workers never block each other. They instantly slide past locked records to pick up the next available job.
Here is how PostgreSQL FOR UPDATE SKIP LOCKED compares to dedicated message brokers when running on standard cloud infrastructure (e.g., AWS c6i.2xlarge, 8 vCPU, 16GB RAM):
| Architectural Metric | PostgreSQL (FOR UPDATE SKIP LOCKED) | Apache Kafka | RabbitMQ / AMQP |
| :--- | :--- | :--- | :--- |
| Transaction Boundary | Single atomic DB transaction | Distributed (Outbox Pattern required) | Distributed (Outbox Pattern required) |
| Operational Overhead | Zero (Uses existing Postgres DB) | Extremely High (Kafka cluster, Kraft/Zookeeper) | Moderate (Erlang cluster management) |
| Ordering Guarantees | Strict per row/account | Strict per partition | Strict per channel |
| Max TPS (Single Node) | 8,000 - 14,000 jobs/sec | 50,000+ events/sec | 15,000 - 25,000 jobs/sec |
| Data Loss Risk | Zero (ACID compliant WAL) | Low (Requires acks=all) | Low (Requires persistent queues) |
| Replay Capabilities | Native SQL queries | Infinite retention on log | None (Messages deleted on ACK) |
Unless your system requires sustained throughput exceeding 20,000 writes per second on a single stream, PostgreSQL easily handles the payload while guaranteeing strict ACID consistency across your entire financial ledger.
Addressing the Counterargument:
Neobot Engineering Standard
Every system deployed by Neobot Tech incorporates enterprise baseline practices. We continuously audit our database topologies, REST API query paths, and frontend modular bundles to prevent latency spikes and ensure top-tier security posture.
Discussion
Comments Coming Soon
We are currently migrating our discussion engine to a new real-time database schema. Check back shortly to join the conversation.