Availability - this service has to be highly available.
Response time - functionality has to have a low response time, e.g., less than 100ms.
Scalability - we will get more and more requests to return the weather forecasts, so the service has to be highly scalable.
The system has a few providers of weather data - integration with third-party weather services.
20,000 requests per second for searching the weather forecast.
2,000 requests per second were made to get the summary weather reporters.
I assume the search whether the request contains 200 bytes of data and the summary weather report is about 10 kbytes. It requires the bandwidth is about 24 Mbits to pass the data.
Let's think the wether data is updated every 2 weeks from the wether third-party services and every update takes 2 Mbytes, it needs to 54 GBytes to store the wether data for 5 years.
forecast(apiKey, country, state, district, city, fromTimestamp, toTimestamp) returns the weather forecast for the given country,state,district and city for specified period.
weatherSummary(apiKey, country, state, district, city, fromTimestamp, toTimestamp) generates the report for region for the previous seasons.
updateWeather(apiKey, country, state, district, city,timestamp,weatherMetrics) updates the weather data by third-party weather providers.
The primary data model for this system is three tablets: one table is for the forecast, for the weather summary and raw data from the weather provider would be stacked up to an object store.
We would use MongoDB to store the data.
Forecast table:
id(10 bytes)
country (100 bytes)
state (100 bytes)
district (100 bytes)
city (100 bytes)
whether data (2 kbytes) temperature, precipitation, humidity.
Weather summary:
id(10 bytes)
country (100 bytes)
state (100 bytes)
district (100 bytes)
city (100 bytes)
whether data (1 kbytes)
The raw data would have the provider-based schema.
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?