We can estimate the user traffic to be in the range of millions of users per day.
We can utilize a container orchestration platform like Kubernetes to provide isolated environments for each merchant. By leveraging Kubernetes, we can create separate pods or nodes for each merchant to ensure isolation and scalability.
The code for the request handler that determines the destination pod based on the merchant context can live in various components depending on the architectural design and requirements of the system. The merchant context can be determined by the merchant_id
There would be a service discovery mechanism to dynamically handle pod discovery and routing based on merchant_id.
Each Pod that maps to a merchant would essentially have its own backend and database.
High Level Diagram(s)
We would also need components and functionalities required for e-commerce stores.
Order Processing Service
Product Management Service
Inventory Management Service
When a merchant makes a request it would go through the API Gateway. The API Gateway acts as a centralized entry point for incoming requests and is responsible for routing requests based on predefined rules. It can inspect the request metadata, making routing decisions, and direct traffic to the appropriate pods.
Once the request hits the pods it will go through the backend logic and hit the cache or database to fetch/update necessary data.
Kong API Gateway
Istio
Data Storage and Database Component
Isolation with Network Policies
Network Policies in Kubernetes provide fine-grained control over pod-to-pod communication, enabling administrators to define rules for traffic flow within the cluster. Here's how advanced networking features like Network Policies can be leveraged in the architecture of Shoplify:
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?