We have a multi-vendor marketplace (e-Commerce) system and plan to move our data structures into a polyglot architecture to improve the performance of reads (critical) and writes (not as critical).
Offers are placed on a product by several dealers. We have local and online offers and the default offer (first to show in the result) is the cheapest online offer.
Therefore we typically have two types of requests, as the image shows. One for Lists (Search results) and a Details view with all offers (local and all/online).
Entity Relationships:
- 1 Offer has 1 Product
- 1 Product has N Offers
- 1 Offer has 1 Dealer
- 1 Dealer has N Offers
My idea is to store the product information in a Cosmos Document Storage since the product information changes rarely. Product entities have search filters (characteristics) as key-value pairs.
Here is a simplified JSON of an offer:
{
"offerNumber": 1234,
"dealerId": 1000,
"price": 19.99,
"quantity": 5,
"product" : {
"title": "My Title",
"filters":
[
{ "key": "value" },
{ "key": "value" }
],
"description": ""
}
}
An offer typically has a stock (quantity) and price as you see in the model. My first approach was to simply store the cheapest online offer in the document database and all other offers into a relational database (Azure SQL).
Because of frequently changing stock and price information and due to the nature of document databases not being optimized for updates, a relational database seems to be the more appropriate storage for the offers. For the products, since they don't change frequently, a document database is the better choice.
My concern is the volume of updates made to stock and prices. Is there any way to optimize a search index using both sources or does anyone have experience with similar use cases and the different storage types on Azure?