Bf-树:现代、读写优化、并发、大于内存范围索引
Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

原始链接: https://github.com/microsoft/bf-tree

## Bf-Tree:并发范围索引 Bf-Tree 是一种为大于可用内存的数据集设计的、读写优化、并发范围索引,由微软研究院用 Rust 开发。它作为一个 Rust crate 提供 (`bf-tree = "0.1.0"` 在 `Cargo.toml` 中),支持 Linux、Windows 和 macOS(在最新的 Linux 版本上经过严格测试)。 该项目强调通过诸如 **shuttle**(确定性线程交错用于发现错误)和 **fuzzing**(随机操作序列用于识别崩溃/不一致性)等技术进行可靠的测试。还提供了全面的 **基准测试** 工具,允许进行性能分析,并提供 NUMA 节点绑定和巨页支持等选项。 欢迎通过 pull request 贡献代码,该项目遵守微软开源行为准则。有关贡献、安全报告和商标使用的详细文档可在项目的 `CONTRIBUTING.md` 和 `SECURITY.md` 文件中找到。

微软发布了“Bf-Tree”,一种新的并发、读写优化范围索引,能够处理大于可用内存的数据集(在GitHub上可用)。该项目由研究员Bradish领导(以Garnet、FASTER和Trill等高性能系统而闻名),由于他的过往记录,在Hacker News社区引起了关注。 讨论重点包括与其他索引方法的比较,包括一个名为“feocask”的只追加哈希索引项目,该项目采用“无显式锁”策略。Bf-Tree与预写式日志的初步测试显示出潜在的死锁,表明它可能尚未准备好投入生产。 然而,评论员们赞扬了该项目的开放性和可重复性——科学研究的关键原则——这得益于其使用Nix进行构建管理。该发布也被认为是对过度炒作的“Show HN”帖子的一个令人耳目一新的改变。
相关文章

原文

Bf-Tree is a modern read-write-optimized concurrent larger-than-memory range index in Rust from MSR.

You can find the Bf-Tree research paper here. You can find more design docs here.

Bf-Tree is written in Rust, and is available as a Rust crate. You can add Bf-Tree to your Cargo.toml like this:

[dependencies]
bf-tree = "0.1.0"

An example use of Bf-Tree:

use bf_tree::BfTree;
use bf_tree::LeafReadResult;

let mut config = bf_tree::Config::default();
config.cb_min_record_size(4);
let tree = BfTree::with_config(config, None).unwrap();
tree.insert(b"key", b"value");

let mut buffer = [0u8; 1024];
let read_size = tree.read(b"key", &mut buffer);

assert_eq!(read_size, LeafReadResult::Found(5));
assert_eq!(&buffer[..5], b"value");

PRs are accepted and preferred over feature requests. Feel free to reach out if you have any design questions.

Bf-Tree supports Linux, Windows, and macOS, although only a recently version of Linux is rigorously tested. Bf-Tree is written in Rust, which you can install here.

Please install pre-commit hooks to ensure that your code is formatted and linted in the same way as the rest of the project; the coding style will be enforced in CI, these hooks act as a pre-filter.

# If on Ubuntu
sudo apt update && sudo apt install pre-commit
pre-commit install

Concurrent systems are nondeterministic, and subject to exponential amount of different thread interleaving. We use shuttle to deterministically and systematically explore different thread interleaving to uncover the bugs caused by subtle multithread interactions.

cargo test --features "shuttle" --release shuttle_bf_tree_concurrent_operations

(Takes about 5 minute to run)

Fuzz testing is a bug finding technique that generates random inputs to the system and test for crash. Bf-Tree employs fuzzing to generate random operation sequences (e.g., insert, read, scan) to the system and check that none of the operation sequence will crash the system or lead to inconsistent state. Check the fuzz folder for more details.

Check the benchmark folder for more details.

cd benchmark
env SHUMAI_FILTER="inmemory" MIMALLOC_LARGE_OS_PAGES=1 cargo run --bin bftree --release

More advanced benchmarking, with metrics collecting, numa-node binding, huge page, etc:

env MIMALLOC_SHOW_STATS=1 MIMALLOC_LARGE_OS_PAGES=1 MIMALLOC_RESERVE_HUGE_OS_PAGES_AT=0 numactl --membind=0 --cpunodebind=0 cargo bench --features "metrics-rt" micro

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Please see CONTRIBUTING.md.

See SECURITY.md for security reporting details.

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

联系我们 contact @ memedata.com