If I need to design the system architecture for a scalable site like amazon/BestBuy, what can be high level system architecture. googled it but did not get much data points.
Below is the high level system diagram based on mine understanding
To illustrate mine understanding I will take two use cases
- Inventory addition to system by seller
- Product search by user
Inventory addition to system by seller :- Seller can upload individual product or he can do bulk upload though any agreed upon format say Excel, CSV etc.
- Once he does seller upload call will go web server (thru load balancer)
- Some business services will exist with in that webserver. For example If I use tomcat(java based web server), java based services can lie with in tomcat. some other service in other/same language can exists as separate process with in same/different machine based on hardware configuration.
- web server will execute seller upload service which will segregate the products based on category and upload it in memcached cluster. This will ensure seller gets the fast response time. There will be separate multiple memcached servers for each category(they will be replicated to handle the server crash)
- Asynch batch jobs in the background will read the data from these memcached clusters and stores it in DB(Mongo DB). Once stored it will update the memcached entry with productId
Product search by user:- user can type any product name and search . This seems to me trick from scaling point of view. I can think of two approaches here
Cached based approach
Keep list of product in memcache say phone.This phone list can contain map where key can be brandName and can be map again. This nested map will contain model as key and product detail as key. Product detail can further contain list of sellers etc.
Now search servive will execute multi get requests(probably map reduce can be leveraged here) to all products stored cache lusters
as system does not know what is the category that name belongs
Fetch it from DB
As we have sharded DB . load is already distributed on DB server. So we can hit the DB, makes use of DB index and fetch details
This point will be same as point 2 in above approach.
Not sure which one is more appropriate and used by any of the major ecommerce app ?
Also Does this architecture looks scalable ? Any improvement points ?