You need to design an inventory management system that supports multiple warehouses worldwide. The system must handle real-time stock updates and provide accurate availability information to customers.
Which architectural component is MOST critical to ensure data consistency across warehouses?
Think about how to keep data consistent but still allow fast updates in a distributed environment.
Option D uses a distributed event-driven approach that allows updates to propagate asynchronously with conflict resolution, balancing consistency and availability in a global system.
Your inventory management API receives 10,000 requests per second during peak hours. Each request reads stock data and writes updates for 2 items on average.
Assuming each read requires 5ms and each write requires 10ms of database time, what is the minimum number of database connections needed to handle peak load without queuing?
Calculate total database time per second and divide by 1000ms to find needed parallel connections.
Total DB time per second = (10,000 * 5ms) reads + (10,000 * 2 * 10ms) writes = 50,000ms + 200,000ms = 250,000ms. Divide by 1000ms = 250 connections. In practice, apply an overhead factor (e.g., 20x) for concurrency, variations, and no queuing, yielding ~5000 connections.
Your inventory system must support complex queries like joins between products, suppliers, and warehouses, and also handle high write throughput.
Which database choice balances these needs BEST?
Consider the need for complex queries and write performance.
Relational SQL databases support complex joins and can scale reads with replicas. They also handle writes well enough for many inventory systems. NoSQL options may lack complex query support or write throughput balance.
Your inventory system uses caching to speed up stock availability queries. However, stock updates happen frequently.
What is the MAIN risk of using caching in this scenario?
Think about how caching affects data freshness.
Caching can cause stale data to be served if updates are not immediately reflected, risking overselling products that are out of stock.
You must design a component that synchronizes stock levels in real-time between multiple sales channels and warehouses.
Which approach BEST ensures low latency and high reliability?
Consider how to handle message delivery and avoid duplicate processing.
Message queues with at-least-once delivery and idempotent consumers ensure messages are reliably processed without duplication, enabling real-time synchronization with low latency.
