Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Speaking of B-trees, I find CouchDB's implementation really interesting: the backing file is append-only, meaning that modifying the tree implies appending the modified nodes at the end of the file (for example, if I change a leaf, than I rewrite it at the end of the file, and rewrite its parent so that it points to the leaf's new position, and so on until we reach the root node).

Sounds like a waste of space, but it solves a bunch of problems, like being crash-proof (since we never overwrite anything, it's always possible to just find the last root) and allowing reads concurrent with a write without any synchronizing necessary. Plus, it's actually optimized for SSD's due to its log-like structure!

CouchDB B-Trees : http://guide.couchdb.org/draft/btree.html Log structures in SSDs : http://lwn.net/Articles/353411/



Massive waste of space though. LMDB is also copy-on-write and crash-proof but doesn't require compaction like CouchDB does.

http://symas.com/mdb/

Read the LDAPCon 2011 paper (and slides) to see how it works and why it's better than CouchDB.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: