Use Cases:
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
path: RootURL/v1/userdetails . Gateway routes the request to user details service
path:RootURL/v1/viewworkout . Gateway routes the request to view worktout service
path:RootURL/v1/logworkout . Gateway routes the request to log workout service
Addressing offline Duplication:
Each workout message generated by the device has a unique id, this id is a combination of UUID of the device and the workout start date and time. Every time a device uploads workout details to the queuing system, the device will note the id of the last added workout session. Next time, when the device is online, it will check the last added workout id and uploads the workout session details which are after the last added workout session. This will ensure that the device functions well even if it is offline for certain periods without missing any workout sessions
a) Database: Considering 1 lakh customers doing 30 min workout on an average with 5%annual growth rate, we will need around 1TB of storage for each primary and replica databases. In azure, we will use General Purpose 8 vCore
32 GB RAM, 1 TB Premium SSD as the DB storage
b) Backend end services (including payload api service): The log workout service, view workout service and user details services are hosted as microservices in their own container. For 1 lakh customers doing 30 min workout on average, each container needs 1 CPU and 1 GB ram to start with. In order to manage for flexibility and reliability, we will start with 2 containers for each backend service being a load balancer and auto scaler. As of now, the estimated requests per second during the peak hour is 4 per second. Auto scaling rule is to scale when requests >50 per second. Additionally, when CPU consumption is >70% scale out and scale in when CPU consumption is <30%. THe log workout service will also scale in and out based on queue length (i.e scale out when >1000 messages waiting in the queue)
c) API gateway: Azure API gateway with consumption tier supporting autoscaling.
d) Secrets Manager: Database secrets and queue secrets are maintained in the secrets manager. Secrets manager will authenticate the requests coming from backend services using RBAC and recieve credentials for interacting with Datbase
e) Queuing system: Queueing system. High available and auto scalable system available on cloud like AWS or Azure or enterprise middleware
f) Authentication Service: Third party authentication service available as SaaS or Microsoft Azure IAM
f) Authentication and authorization architecture:
g) Network architecture:
API gateway will have a public IP. Remaining services will have a private IP.