PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Meta

Design versioned in-memory key-value store

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of in-memory data structures, versioning semantics, rollback mechanisms, and performance trade-offs between time and space.

  • medium
  • Meta
  • System Design
  • Machine Learning Engineer

Design versioned in-memory key-value store

Company: Meta

Role: Machine Learning Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

You are asked to design an **in-memory key–value store** that supports **versioning** and **rollback**. ## Requirements - Store key–value pairs in memory (`string` keys, arbitrary JSON/string values is fine). - Support **multiple versions** of the store over time. - Ability to **rollback** the entire store to a **previous version**. - Reads should return values from the **current active version**. - Assume single-process (no distributed requirements) unless you explicitly choose to extend it. ## Suggested API (you may change it) - `put(key, value) -> version_id` : writes and creates a new version - `get(key) -> value | null` : reads from the current version - `delete(key) -> version_id` - `snapshot() -> version_id` : optional explicit snapshot - `rollback(version_id) -> void` : make `version_id` the current version ## Constraints / Discussion points - Target good asymptotic performance for `get`, `put`, and `rollback`. - Discuss time/space trade-offs (copy-on-write vs. log-based vs. persistent data structures). - Consider edge cases: rolling back and then writing again (branching history), deleting keys, and memory growth.

Quick Answer: This question evaluates understanding of in-memory data structures, versioning semantics, rollback mechanisms, and performance trade-offs between time and space.

Related Interview Questions

  • Design an Online Game Leaderboard - Meta (hard)
  • Design an Instagram-like Media Feed - Meta (medium)
  • Design an Online Judge and Live Comments - Meta (medium)
  • Design an Instagram-like platform - Meta (medium)
  • Design a Coding Contest Platform - Meta (medium)
Meta logo
Meta
Nov 28, 2025, 12:00 AM
Machine Learning Engineer
Onsite
System Design
7
0
Loading...

You are asked to design an in-memory key–value store that supports versioning and rollback.

Requirements

  • Store key–value pairs in memory ( string keys, arbitrary JSON/string values is fine).
  • Support multiple versions of the store over time.
  • Ability to rollback the entire store to a previous version .
  • Reads should return values from the current active version .
  • Assume single-process (no distributed requirements) unless you explicitly choose to extend it.

Suggested API (you may change it)

  • put(key, value) -> version_id : writes and creates a new version
  • get(key) -> value | null : reads from the current version
  • delete(key) -> version_id
  • snapshot() -> version_id : optional explicit snapshot
  • rollback(version_id) -> void : make version_id the current version

Constraints / Discussion points

  • Target good asymptotic performance for get , put , and rollback .
  • Discuss time/space trade-offs (copy-on-write vs. log-based vs. persistent data structures).
  • Consider edge cases: rolling back and then writing again (branching history), deleting keys, and memory growth.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Meta•More Machine Learning Engineer•Meta Machine Learning Engineer•Meta System Design•Machine Learning Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.