Storage
Number of logs:
Connections
// Search log
searchLog(query, limit, pageSize, pageToken) // consider ES-like query
// Get metrics
getMetrics(query) // consider PQL-like query
We choose several different storage:
We implement a standard schemas for logs and metrics.
Log:
Metrics
LogAgent is deployed alongside with service (sidecar, or as a agent service in the same container) that ships logs to the LogQueue.
From the log queue, we have multiple consumers:
Client send queries to QueryService, which forwards the queries to ES or Prometheus.
Ingestion flow
Query path
One key issue is that a hot service can generate disproportionate amount of logs. So sharding by service id is not sufficient. In addition to service id, we also shard by time interval. For example, we shard by every 1 hour interval. Assume 10% of the 10k services generate 90% of the logs, then each such service: 100 logs/sec and 20k / sec which should fit within one shard.
TSDB
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?