Which statement best describes the purpose of idempotency in API requests?
Think about what happens when a client sends the same request multiple times due to network issues.
Idempotency means that repeating the same request multiple times results in the same state as making it once. This helps safe retries.
You are designing a payment API that must support safe retries. Which design choice best supports idempotency?
Consider how the server can recognize repeated requests safely.
Using a unique transaction ID lets the server detect and ignore duplicate requests, ensuring idempotency.
Your system uses idempotency keys to avoid duplicate processing. As traffic grows, what is the best approach to scale idempotency key storage?
Think about balancing fast access and storage limits as traffic increases.
A distributed cache with expiration provides fast access and limits storage size, helping scale idempotency key management.
What is the main tradeoff when setting a short expiration time for stored idempotency keys?
Consider what happens if a retry arrives after the key is removed.
Short expiration limits storage but may cause duplicates if retries come after keys expire, risking repeated processing.
Your API receives 10,000 requests per second, each with a unique idempotency key stored for 24 hours. Each key and result entry uses 1 KB of storage. What is the approximate storage needed to hold all keys for 24 hours?
Calculate total requests in 24 hours and multiply by storage per key.
10,000 requests/sec * 3600 sec/hr * 24 hr = 864 million keys. 864 million KB = 864 GB.