高级农民
- 积分
- 1268
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2018-12-20
- 最后登录
- 1970-1-1
|
来一道
This is a system design question in which you'll be asked to design a system that stores some timeseries data for output to a CSV.
You should just sketch out a system for storing the data; you do not need to actually implement it. This might model a system for recording sensor readings from IoT devices, or monitoring a large quantity of servers. You should focus on scalability, reliability and performance.
Imagine we have a data source that produces some timeseries data, In particular, each time the data source produces data at a given (t), it produces an ordered tuple (Xt1, Xt2,..., Xtn), where each Xti is a 32-bit integer. Let's suppose the data is produced every 10ms, and n (the size of the tuple) is 1000. Thus, there are 100 (Xt1, Xt2,...., Xt1000) tuples produced every second.
To query the data, your system will be given a (t0, t1) pair, for which, you must produce a CSV containing all data recorded between t0 and t1. Each row will always contain all n data points sampled at a given t, and thus will have n + 1 columns (since the first column is for t). The first row is a header for clarity.

You should expect (t0, t1) to be fairly large (months or years)
Thus, in sum, you should design a system that provides two operations:
* Record(t, Xt,1, Xt,2, .... Xt,n), which doesn't return any data. It is called every 10 milliseconds to add data to your system.
* Query(t0, t1), which returns a CSV as described above. It is called to produce CSV.
Your interviewer may add constraints or requirements once you finish an initial design, so try to build something as simple as possible first and then iterate.
|
|