Live data from Hacker News

Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

github.com

11–20 of 24 posts

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#11

No multithreaded write benchmarks. That's a major omission, given that's where you'll see the biggest difference between b-trees and LSM trees. The paper also talks about the overhead of the mapping table for node lookups, and says "Bf-Tree by default pins the inner nodes in memory and uses direct pointer addresses to reference them. This allows a simpler inner node implementation, efficient node access, and reduced…

Sure, but on principle, looking at the paper, I'd expect it to outperform B-trees since write amplification is reduced, generally. You thinking about cases requiring ordering of writes to a given record (lock contention)?

I think their claims of write amplification reduction are a bit overstated given more realistic workloads.

It is true that b-trees aren't ideal in that respect, and you will see some amount of write amplification, but not enough that it should be a major consideration, in my experience

You really have to take into account workingset size and cache size to make any judgements there; your b-tree writes should be given by journal/WAL reclaim, which will buffer up updates.

A purely random update workload will kill a conventional b-tree on write amplification - like I mentioned, that's the absolute worst case scenario for a b-tree. But it just doesn't happen in the real world.

For the data I can give you, that would be bcachefs's hybrid b-tree - large btree nodes (256k, typically) which are internally log structured; I would consider it a minor variation on a classical b-tree. The log structuring mean that we can incrementally write only the dirty keys in a node, at the cost of some compaction overhead (drastically less than a conventional LSM).

In actual real world usage, when I've looked at the numbers (not recently, so this may have changed) we're always able to do giant highly efficient b-tree writes - the journal and in-memory cache are batching things up as much as we want - which means write amplification is negligible.

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#12

Earlier quoted context omitted.

Sure, but on principle, looking at the paper, I'd expect it to outperform B-trees since write amplification is reduced, generally. You thinking about cases requiring ordering of writes to a given record (lock contention)?

I think their claims of write amplification reduction are a bit overstated given more realistic workloads. It is true that b-trees aren't ideal in that respect, and you will see some amount of write amplification, but not enough that it should be a major consideration, in my experience You really have to take into account workingset size and cache size to make any judgements there; your b-tree writes should be given…

Of course mileage may vary with different workloads, but are there any good benchmarks/suites to use for comparison in cases like these? They used YCSB but I don't know if those workloads ([1]) are relevant to modern/typical access patterns nor if they're applicable to SQL databases.

You thinking about running some benchmarks in a bcachefs branch (:pray:)?

I want to see this data structure prototyped in PostgreSQL.

[1]: https://github.com/brianfrankcooper/YCSB/tree/master/workloa...

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#14

Earlier quoted context omitted.

I think their claims of write amplification reduction are a bit overstated given more realistic workloads. It is true that b-trees aren't ideal in that respect, and you will see some amount of write amplification, but not enough that it should be a major consideration, in my experience You really have to take into account workingset size and cache size to make any judgements there; your b-tree writes should be given…

Of course mileage may vary with different workloads, but are there any good benchmarks/suites to use for comparison in cases like these? They used YCSB but I don't know if those workloads ([1]) are relevant to modern/typical access patterns nor if they're applicable to SQL databases. You thinking about running some benchmarks in a bcachefs branch (:pray:)? I want to see this data structure prototyped in PostgreSQL. […

I've got microbenchmarks for the bcachefs btree here: https://evilpiepirate.org/git/bcachefs.git/tree/fs/bcachefs/...

They're ancient, I only have pure random and sequential benchmarks - no zipf distribution, which really should be included.

Feel free to play around with them if you want :) I could even find the driver code, if you want.

I've always been curious about PostgreSQL's core b-tree implementation. I ran into a PostgreSQL developer at a conference once, and exchanged a few words that as I recall were enough to get me intrigued, but never learned anything about it.

In a system as big, complex and well optimized as either bcachefs or postgres, the core index implementation is no longer the main consideration - there's layers and layers, and the stuff that's fun to optimize and write paper about eventually gets buried (and you start thinking a lot more about how to lay out your data structures and less about optimizing the data structures themselves).

But you know in something like that there's going to be some clever tricks, that few people know about or even remember anymore :)

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#15

I get excited every time I see a paper from Bradish. I've learned so much about high performance software from studying systems that he has worked on. (not to diminish his many co-authors and contributors) Some of his other projects: [0] https://github.com/microsoft/garnet [1] https://github.com/microsoft/FASTER [2] https://github.com/microsoft/Trill

Minor typo. Author's name is - Badrish.

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#16

Earlier quoted context omitted.

I think their claims of write amplification reduction are a bit overstated given more realistic workloads. It is true that b-trees aren't ideal in that respect, and you will see some amount of write amplification, but not enough that it should be a major consideration, in my experience You really have to take into account workingset size and cache size to make any judgements there; your b-tree writes should be given…

Of course mileage may vary with different workloads, but are there any good benchmarks/suites to use for comparison in cases like these? They used YCSB but I don't know if those workloads ([1]) are relevant to modern/typical access patterns nor if they're applicable to SQL databases. You thinking about running some benchmarks in a bcachefs branch (:pray:)? I want to see this data structure prototyped in PostgreSQL. […

I think a better candidate to prototype would be SQLite, at least to have a better sense of how would bf-tree behave on real world

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#18

Why not add an LSM memtable on top of the cow b+ tree? Use the skiplist as a write buffer and write to the b+ tree in batches when the skiplist is frozen.

Bftree solves one non-obvious pain point - caching when your data set is random (the key is a hash) and the data is smaller than the page size. LSM reads are based on block size; same with caching. So if your record is 8 bytes, you end up caching the remaining ~4 KB, and the hit rate will be pretty low.

Re: Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index

#20
post #19

Was the link changed? Right now it points to the github page, and it doesn't really say why anyone would care about it.

The top of the readme links to the accompanying paper, which explains very clearly why you would care: https://badrish.net/papers/bftree-vldb2024.pdf

I admit I’ll agree that that extra hop was a little confusing to me though. I guess people just like GitHub and don’t like PDFs.

Post reply on HN