Question

I'm looking for a solution to add persistence to my native-code application. It should be simple (no SQL), fast, and most-importantly reliable.

The best approach I can think of is using memory-mapped files. It's as simple and fast as it can get - you simply store the values in plain-data arrays in "memory". However, I don't think it's very reliable - a power failure could leave the database in an inconsistent or corrupted state. Being able to transactionally sync a group of memory-mapped files to disk would solve this, but I don't think it's possible. Also, unless the filesystem supports snapshots or COW cloning (e.g. Brtfs), backups would mean having to stop the application completely while the files are being copied.

Does anyone have better ideas?

OTHER TIPS

Your list of requirements sounds like Redis. See http://redis.io/ for more.

Another possibility is Cassandra. See http://cassandra.apache.org/ for more on that.

RocksDB or levelDB are other great options.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top