Storage
Requests:
The schema for the weather data could be
The schema for location
User data
Historical data can be archived using an object storage, for example AWS S3.
Please refer to the High level diagram
Please refer to the Sequence diagram
Database: looking at the scale, with TB daily, we are looking at a large scale data storage for weather data, while the access pattern is quite simple, a NoSQL solution is best fit, for example Cassandra
Cache: Redis cluster is well suited for the use case, since it support high throughput, millions request per second, replications are built-in for high availability
Kafka: pull-based, reliable messaging service, which has an at-least-once guarantee, also each consumer could process the data at its own pace, also Kafka persist data on disk which improve the durability of the data
The Redis could be a bottleneck as it has limited memory, an effective algorithm should be in place for eviction and expiry.
The daemon process to archive data should utilise an effective algorithm and approach since it may flush too much data at a time, partitioned processor should be in place.
The service heavily rely on Kafka, which becomes a single point of failure, we need to make sure Kafka is high available, also a proper way to handle unavailability
The system design for now didn't mention much about global setup, every single component in this system should have multi regional setup, including Load Balancers. Cassandra should be globally setup with regional partitions. Requests should be routed based on geographical edge points.