Get the latest tech news
Exactly-Once Payments at Airbnb
Eventually consistent databases make it really hard to ensure that payments are made only once. Idempotency and clever retries make it possible.
When the server gets a request, it checks if the key is already stored in the database, and based on that it either returns the cached response, or calls the downstream service. Which means that there’s a moment when the server has received the request and stored its idempotency key, but the response hasn’t been produced. We’ve learned the hard way that network calls (RPCs) during the Pre and Post-RPC phases are vulnerable and can result in bad things like rapid connection pool exhaustion and performance degradation.
Or read this on Hacker News