1

I'm building a crypto-exchange and looking for a RELIABLE and fast db to save incoming orders.

  1. Had bad experience with Berkeley DB.
  2. Checked Leveldb, but according to wikipedia "LevelDB is widely noted for being unreliable and databases it manages are prone to corruption."
  3. Can't afford kdb+.

What are my options? Should I roll out my own key-value store?

BTW: must have a c/c++ api

user3839198
  • 115
  • 1
  • 10
  • I didn't know of the "power" of LevelDB :-) I thought it was rock hard. – xanatos May 23 '18 at 19:13
  • Are you sure you need a key/value db? what advantage will you get from it? I thought a classical relational db would be better. In the end you probably have to keep all the open orders in ram to match them, otherwise it will be quite slow, and you use the DB only to store the orders for backup, and the closed orders that are history – xanatos May 23 '18 at 19:15
  • I thought that too until reading the wikipedia entry. – user3839198 May 23 '18 at 19:17
  • I'm thinking to save all incoming orders to a key-value store first before feeding into the match engine. – user3839198 May 23 '18 at 19:22
  • You could use postgresql like that... In the end the "value" part is small (price, quantity, user, currency pairs, datetime of opening...)... You skipped MemcacheDB. It is key-value, with persistency – xanatos May 23 '18 at 19:23
  • thanks, don't know much about MemcacheDB, will check it out – user3839198 May 23 '18 at 19:25
  • Other problem of the DB you named (Berkeley DB and LevelDB) is that they are single process (https://stackoverflow.com/questions/1749885/can-a-berkeley-database-be-opened-and-accessed-from-multiple-programs-at-the-sam and https://github.com/google/leveldb/issues/182), but an exchange grows quickly to multiple machines. MemcacheDB should be a server that supports multiple concurrent connections – xanatos May 23 '18 at 19:30
  • lookup wiredtiger. – amirouche May 24 '18 at 13:11
  • what about sqlite? – amirouche May 24 '18 at 13:11
  • Thanks, amirouche. Don't know wiredtiger. Will check it out. – user3839198 May 25 '18 at 13:00
  • Not sure about sqlite. It seems that there are too many ways to corrupt a sqlite db. https://www.sqlite.org/howtocorrupt.html – user3839198 May 25 '18 at 13:01

0 Answers0