On one microdata benchmark, BetrFS provides more than 4× the performance of ext4 or XFS. BetrFS is an ongoing prototype effort, and requires ad- ditional data-structure tuning to match current general-purpose file systems on some operations such as deletes, directory renames, and large sequential writes. Nonetheless, many applications realize significant performance improvements. For instance, an in-place rsync of the Linux kernel source realizes roughly 1.6–22× speedup over other commodity file systems.
Crash一致性,使用事务的方式实现Crash一致性,和常见的一些也是基于日志的方式, TokuDB transactions are equivalent to full data journaling, with all data and metadata updates logged to a file in the underlying ext4 file system. Log entries are retired in-order, and no updates are applied to the tree on disk ahead of the TokuDB logging mechanism.
压缩,使用完整路径作为Key的时候,其实有很多的数据都是系统,这个时候使用压缩能得到很好的效果, Both indexes use full paths as keys, which can be long and repetitive, but TokuDB’s compression mitigates these overheads. Using quicklz, the sorted path names in our experiments compress by a factor of 20, making the disk-space overhead manageable.
BetrFS中还依赖于ext文件系统实现其它的一些如空闲空间管理的功能, TokuDB relies on an underlying file system to act as a block and free space manager for the disk. Conventional file systems do a good job of stor- ing blocks of large files adjacently on disk, especially when writes to the file are performed in large chunks.
0x03 评估
具体内容可以参看[1]
Optimizing Every Operation in a Write-optimized File System
0x10 引言
这篇Paper讲的是BetrFS 0.2上面的一些优化,主要讲了它使用的3种技术:late-binding journaling, zon-ing, 和 range deletion。这里的总结也只是看看这3种优化的技术
BetrFS 0.2 performs directory scans 2.2× faster, and small random writes over two orders of magnitude faster, than the fastest conventional file system. But unlike BetrFS 0.1, it renames and deletes files commensurate with conventional file systems and performs large sequential I/O at nearly disk bandwidth.
查找和重命名之间的平衡,需要这个优化的原因就是提高的BetrFS中重命名文件夹可能的很高的成本。这里的基本思路就是讲索引结构分区。基本的思路如下面的图所示。这样做的一个出发点就是可以将一个zone作为一个整体移动。但是在一些情况下还是需要和之前一样的操作, for example, renaming “/local/bin” to “/docs/tools” requires (1) deleting all the keys of the form (0, “/local/bin/p”) in the metadata index, (2) reinserting them as keys of the form (1, “/tools/p”), (3) deleting all keys of the form (0, “/local/bin/p”, i) from the data index, and (4) reinserting them as keys of the form (1, “/tools/p”, i).
This new version, BetrFS 0.4, performs recursive greps 1.5x faster and ran- dom writes 1.2x faster than BetrFS 0.3, but renames are competitive with indirection-based file systems for a range of sizes.
0x21 两种优化方式
Tree Surgery主要的优化目标还是大量文件重命名时候的问题。使用的方法是重命名的时候直接去修改树的结构,而不是使用插入新的在去删除的方式。基本的步骤如下:1. 找到新旧路径的最小公共祖先结点; 2. 将需要移动的部分分离出来,如下面的图所示;3. 将分离出来的部分移植到改动之后的路径上面;4. 对改动之后的树结构进行修复。当然实际的操作的实现还是很复杂的,可以参看论文[3];
Batched Key Updates,这里主要基于这样一个观察,由于使用完整的路径作为key,这样其实有很多的数据是多余的(相同的)。对于一段路径,找到它们相同的前缀,把这个前缀的信息保存在它们的父结点中,而它们则是需要保存剩余的部分即可, Consider the prefix encoding for a sequence of strings. In this compression method, if two strings share a substantial longest common prefix (lcp), then that lcp is only stored once. We apply this idea to Bε-trees. The lcp of all keys in a subtree is removed from the keys and stored in the subtree’s parent node. We call this approach key lifting or simply lifting for short.
0x22 评估
具体可以参看[3].
参考
BetrFS: A Right-Optimized Write-Optimized File System, FAST ‘15.
Optimizing Every Operation in a Write-Optimized File System, FAST ‘16.