Reliable and efficient key--value database for Linux? [closed]

独自空忆成欢 提交于 2019-11-28 15:43:49

I've had good luck with the Tokyo Cabinet/pytc solution. It's very fast (a bit faster than using the shelve module using anydbm in my implementation), both for reading and writing (though I too do far more reading). The problem for me was the spartan documentation on the python bindings, but there's enough example code around to figure out how to do what you need to do. Additionally, tokyo cabinet is quite easy to install (as are the python bindings), doesn't require a server (as you mention) and seems to be actively supported (stable but no longer under active development). You can open files in read-only mode, allowing concurrent access, or read/write mode, preventing other processes from accessing the database.

I was looking at various options over the summer, and the advice I got then was this: try out the different options and see what works best for you. It'd be nice if there were simply a "best" option, but everyone is looking for slightly different features and are willing to make different trade-offs. You know best.

(That said, it'd be useful to others if you shared what ended up working the best for you, and why you chose that solution over others!)

LMDB is the most memory-efficient database around http://symas.com/mdb/inmem/

and also proven to be the most reliable - completely crash-proof. http://wisdom.cs.wisc.edu/workshops/spring-14/talks/Thanu.pdf

Of the ones you've mentioned, Tokyo Cabinet has documented corruption issues https://www.google.com/search?q=cfengine+tokyo+cabinet+corruption

BerkeleyDB also has well-documented corruption issues, as does Bitcask. (And bitcask is an in-memory-only DB anyway, so useless for your 1MB RAM requirement.)

LMDB is also well-supported in Python, with a couple different bindings available. https://github.com/dw/py-lmdb/ https://github.com/tspurway/pymdb-lightning

Disclaimer - I am the author of LMDB. But these are documented facts: LMDB is the smallest, most efficient, and most reliable key/value store in the world and nothing else comes anywhere close.

cdb can handle any database up to 4 GB, making it too small for the 20GB matter at hand.

Riak runs on Linux, and allows you to dynamically add nodes

how about Python 3.0's dbm.ndbm ?

Another suggestion is TDB (a part of the Samba project). I've used it through the tdb module, however I can't say I've tested its reliability on crashes; the projects I used it in didn't have such requirements, and I can't find relevant documentation.

how about a SQLite?

I've used bsddb.hashlib() with Python, it worked pretty good.

You might like djb's cdb, which has the properties you mention.

Andy Dent

In my query for a cross-platform ISAM-style database (similar), I also received suggestions for the embedded version of Firebird and GLib.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!