Inventory Reservation System with TTL Auto-Release
Design a high-concurrency inventory management system that supports atomic stock reservation for a 5-minute window. The system must expose an interface to block inventory for an order, confirm the order, and query current stock levels. If an order is not confirmed within 5 minutes, the reserved stock must be released back to the available pool automatically. Discuss how you would handle race conditions between confirmation and expiration, ensure strong consistency under high load (e.g., flash sales), and maintain system reliability in the event of worker or cache failures.
RedisPostgreSQLLuaSQSRabbitMQTransactional OutboxOptimistic Locking
00