We want to load a feed based on the homepage showing the most important sports news
Real time score update for a sport/event that updates dynamically as the game continues.
We want really low latency, we can sacrifice consistency a bit since the sports event is constantly changing, and we don't need to be exactly real time from a global perspective.
Imagine we are designing something like a TSN. With 100 million active users monthly, and lets say an average of 1 billion requests a month. The actual feed would need to support 10000 requests per second assuming Approximately 100000 requests/second.
Assuming there are 10 large sports that we support (NFL, NHL, NBA, Boxing, UFC, Soccer, Baseball etc) and Each sport has about 30 different teams, and each team has 30 different players, thats 10 * 900 = 9000, players of data we need. Each player will have metadata of lets say 10kb. That is 90000kb or 90mb of just metadata related to players, then maybe another 1mb per team, so 100mb of data we need to be updating every couple of minutes as these updates are not as relevant to be live.
We also then need live updates during a game which is 60 players, two teams, location meta data. Lets say 10mb a second to be sure.
GET https://tsn.com/home which will get all the data on the homepage feed.
GET https://tsn.com/team/:id which will get all the data for a specific team.
GET https://tsn.com/player/:id which will get all the data for a specific player.
Sub wss://tsn.com/live for lets say https://tsn.com/:Id which will subscribe to a generic websocket connection on the page. We could save the subscribers to a hash type subscribers {}, where the key is the gameId, and all the userIds are stored as the value. From the server we do this on a new websocket connection for a new game with "Id". We then use external apis to get data related to that game assuming we don't do this in house. Then We simply publish these changes to all subscribers of gameId 'Id'
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
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...
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?