/ The Arena
Prove your engineering skills.
GLOBAL+50 XP
Build an Idempotent Payment Engine with Distributed Locks
Landmark Capstone: Distributed Idempotency Engine
In distributed systems, network partitions and client retries can result in catastrophic duplicate transactions. Your objective is to build a production-grade Idempotency Middleware backed by Redis.
Requirements:
- Cache Hit: If a request with
idempotencyKeyhas already been executed, immediately return the cached status and payload withisIdempotentHit: true. - Concurrent Lock Acquisition: Acquire an atomic distributed lock (
SET NX EX). If another worker is actively executing the same key, return HTTP409 Conflictand{ error: 'CONCURRENT_REQUEST_IN_PROGRESS' }. - Payload Fingerprint Validation: If a subsequent request reuses an existing
idempotencyKeywith a mismatched HTTP method, path, or body payload, return HTTP422 Unprocessable Entityand{ error: 'IDEMPOTENCY_KEY_PAYLOAD_MISMATCH' }. - Atomic Commitment & Safe Unlock: Commit the response to Redis with a 24-hour TTL and release the lock to guarantee safe concurrent execution.
Join The Arena
Create an account to submit your implementation, test against our containerized CI suite, and climb the global leaderboard.
Create AccountALREADY HAVE AN ACCOUNT? LOG IN