Average TPS = (Average User Activity/ 60 seconds) * Expected Concurrent Users
Average TPS = 1/60 *10000 = 166,67 TPS
Peak TPS = 166.67 * 5 = 833,33 TPS
each instance can handle up to 200 TPS
Database requirements 1000 IOPS (Input/output operations per second)
Number of Presence Services = 833,33 / 200 == ca. 5 instances
Database IOPS Required = 833,33 * 1000 = 833330 IOPS
Key considerations in the database design:
the client sends an http request to the load-balancer, which utilizes round-robin to propagate it to the proper server. We use multiple servers as API Gateways, which are able then to route our requests to the corresponding services. We have three services which are connected to the API Gateway, which are The Presence Service, the user Service and the Notification Service. The Presence Service is used to update or get the user's presence status. It also has a NoSQL Database for high reliability and fast response. The presence Service also utilizes a cache for faster lookups.
There is then also the User Service, which has a rate limiter for write requests and a cache for read requests between the API Gateway and the User service. The User Service is used for
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
additionally there could be a better authentication inplace, also we could add an encryption for the databases so we ensure privacy for our customers and their data
to reduce network latency we could use rate limiters
To mitigate database outages we could utilize database sharding or creating replicas of databases, so that when database goes off we have the other databases available
Use health check services like prometheus and graphana to check the health of all services and whether they are up and running and everything is working great
add logging to be able to track potential errors, when they occur and mitigate potential future failures