Lets say we are a log collection platform for SaaS businesses.
Our system will write 1B events per day.
Storage = 1B * 1KB ... = 1TB per day of storage.
Storage for a 2 year period = 1TB * 2 * 365 = 730TB --> 1PB adding an extra buffer for growth.
StoreLogs():
Input: id, timestamp, type
Output: 201 created
SearchLogs():
Input: id, range
Output: List of Events logs
ReadLogs():
Input: type
Output: List of Events logs
User: id, websiteUrl
LogEvent: id, type, timestamp, ownedBy
Quick Access Pattern -->
Given a User, read all log events
Given the heavy write workload that our system will have to bear, I think I will go with a NoSQL database, more precisely Cassandra, given that all its nodes are masters and able to write.
For reading event log data, I will leverage the capabilities of a search engine, which will enable the scalability, high availability and fault tolerance requirements of the system.
Store logs: client -> LB -> API -> Data collection -> NoSQL DB
Search logs: Publisher reads -> NoSQL DB -> publish event to message broker -> data is processed -> feed into the search engine
Read logs: Publisher reads -> NoSQL DB -> publish event to message broker -> data is processed -> feed into the search engine
The data collection pipeline:
The data processing service:
The Alert notification service:
Failure: Load Balancer
Failure: API Gateway
Failure: Network connection to NoSQL database, potential data loss