注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
[Blind上看到的,大家自行判断]
.. Resumable Versioned Key-Value Store.google и
. ΧYou're building an in-memory key-value store used by a distributed training job to checkpoint model metadata.
Part 1. Implement set(key, value, timestamp) and get(key, timestamp). get returns the value that was set at the closest timestamp at or before the given timestamp. Timestamps are strictly increasing per key, but writes may arrive out of order due to network delay, and your store should handle that gracefully.
. 1point 3 acresPart 2. Add get_latest(key), which returns the most recent value. "Most recent" means the value with the highest timestamp, unless a newer write has been received, in which case it should reflect what the client most recently intended.
Part 3. The store must be serializable so a crashed job can resume. Implement serialize() and deserialize(). A deserialized store must behave identically to the original, including for any writes that were in flight at serialization time.
Part 4. Values are immutable once read. If get returns a value, any later set for that key at an earlier timestamp should be rejected. However, backfilling historical data must still be supported.
Constraints: All operations O(1). Memory usage should not grow with the number of versions. Thread-safe, though you may assume single-threaded access. If a key doesn't exist, return None or raise, whichever is consistent with Part 4.
. Waral dи,
Follow-up: How would you scale this to 10,000 GPUs? |