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
Each merchant's pod comprises a set of microservices or services dedicated to that merchant's operations. These services include product management, order processing, payment handling, etc., tailored to the specific needs of the merchant.
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:
Scalability - This isolation ensures that the system can easily scale horizontally by adding more resources to support an increasing number of merchants without impacting the performance of existing merchants.
Data Isolation and Security - By assigning a separate Database Shard to each merchant, the architecture enhances data isolation and security. Each merchant's data is stored in a dedicated environment, minimizing the risk of data leakage and ensuring data privacy and compliance with regulations such as GDPR. The use of a Service Mesh also enables secure communication between microservices within the cluster.
High Availability: The architecture promotes high availability by distributing services across multiple pods within the Kubernetes cluster. In case of pod failures, Kubernetes can automatically spin up new pods to maintain service availability. This redundancy enhances the reliability of the system and reduces the risk of downtime.
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?