Computational notebooks (e.g., Jupyter, Google Colab) are widely used by data scientists. A key feature of notebooks is the interactive computing model of iteratively executing cells (i.e., a set of statements) and observing the result (e.g., model or plot). Unfortunately, existing notebook systems do not offer time-traveling to past states: when the user executes a cell, the notebook session state consisting of user-defined variables can be irreversibly modified - e.g., the user cannot 'un-drop' a dataframe column. This is because, unlike DBMS, existing notebook systems do not keep track of the session state. Existing techniques for checkpointing and restoring session states, such as OS-level memory snapshot or application-level session dump, are insufficient: checkpointing can incur prohibitive storage costs and may fail, while restoration can only be inefficiently performed from scratch by fully loading checkpoint files. In this paper, we introduce a new notebook system, Kishu, that offers time-traveling to and from arbitrary notebook states using an efficient and fault-tolerant incremental checkpoint and checkout mechanism. Kishu creates incremental checkpoints that are small and correctly preserve complex inter-variable dependencies at a novel Co-variable granularity. Then, to return to a previous state, Kishu accurately identifies the state difference between the current and target states to perform incremental checkout at sub-second latency with minimal data loading. Kishu is compatible with 146 object classes from popular data science libraries (e.g., Ray, Spark, PyTorch), and reduces checkpoint size and checkout time by up to 4.55x and 9.02x, respectively, on a variety of notebooks.
翻译:计算笔记本(例如Jupyter、Google Colab)被数据科学家广泛使用。笔记本的一个关键特性是其交互式计算模型,即迭代执行单元(即一组语句)并观察结果(例如模型或绘图)。遗憾的是,现有笔记本系统无法提供回溯至历史状态的时间旅行功能:当用户执行单元时,由用户定义变量构成的笔记本会话状态可能被不可逆地修改——例如,用户无法“撤销删除”数据框的某一列。这是因为与数据库管理系统不同,现有笔记本系统不会跟踪会话状态。现有的会话状态检查点与恢复技术(如操作系统级内存快照或应用级会话转储)存在不足:检查点操作可能产生极高的存储开销且可能失败,而恢复操作只能通过完整加载检查点文件从头开始执行,效率低下。本文提出了一种新型笔记本系统Kishu,该系统通过高效且容错的增量检查点与检出机制,实现了在任意笔记本状态间进行时间旅行。Kishu创建了体积小巧的增量检查点,并以新颖的共变量粒度准确保持了复杂的变量间依赖关系。当需要回溯至先前状态时,Kishu能精确识别当前状态与目标状态之间的差异,从而在亚秒级延迟内以最小数据加载量执行增量检出操作。Kishu兼容146种来自主流数据科学库(如Ray、Spark、PyTorch)的对象类,在多种笔记本场景下将检查点大小与检出时间分别降低了最高4.55倍与9.02倍。