We are designing a real-time inventory system for an e-commerce site that aggregates its inventory from multiple suppliers.
- Our visitors can search and purchase items from our site
- We get inventory updates from multiple suppliers on different schedules throughout the hour. The updates comes in the form of an inventory snapshot of their system. In other words, we do not get a list of what was sold or what was added from them, only a snapshot of their inventory at the time of the update.
What's the best design for this system so that we can update our inventory without disturbing the e-commerce experience?
Requirements:
- Ensure our inventory store does not fluctuate. When we refresh our inventory with updates from our suppliers, we can't just delete the old records, then insert the new records. This will momentarily cause an inaccurate state in our inventory store.
- Ensure there are no duplicates in the inventory store at all times.
The solution doesn't have to be restricted to database design. We are open to solutions involving the database, in-memory distributed cache or any other means.
UPDATE (@Andrew Keith): My question is focusing on how to maintain an inventory store (whether a database, or an in-memory cache) so that the inventory updates can be applied to the store while keeping the store open for e-commerce operations (e.g., search, checkout, etc).