MVStore vs H2 performance

356 views
Skip to first unread message

wburzyns

unread,
May 19, 2021, 10:45:19 AM5/19/21
to H2 Database

Hi,

I need some insight regarding the performance of MVStore persisted transactional maps (used in a single-thread environment).
I did some benchmarks with MVStore (using it the same way it's used in the TestTransactionStore.java) and - to my great surprise - the performance is worse than performance of H2 used in the same scenario (i.e. as a key-value store).

In MVStore I'm operating on a map declared as TransactionMap<Long, byte[]>. In H2 I have DATA_TABLE(ID BIGINT NOT NULL PRIMARY KEY, DATA BLOB). While inserts are 30-40% faster in case of MVStore, the commit operation (i.e. Transaction.commit() vs SQL "COMMIT") is ~9x slower in case of MVStore.

1) I changed the way my MVStore is built to the same settings H2 is using, but it didn't help:
MVStore.Builder().fileName(mvStorePath).compress().autoCommitDisabled().autoCompactFillRate(90).pageSplitSize(65536).open()

2) I've walked with debugger through H2 row insertion and noticed that H2 is opening maps not via Transaction.openMap() but via TransactionMap.getInstance(txn), however changing the MVStore benchmark code accordingly did not improve my results at all.

I don't understand how it is possible that H2 that uses MVStore as its storage engine and adds a lot of other stuff on top of it (SQL) can be faster than raw MVStore. Am I doing something wrong? If I don't, is there a way I can mimic H2's way of using MVStore to improve commit performance?


Thanks,
wburzyns

Andrei Tokar

unread,
May 19, 2021, 6:48:12 PM5/19/21
to H2 Database
First of all it is absolutely not aples-to-apples, and the fact of using BLOB sql type just makes the water more muddy. Now, You have to realize that database commit, won't write it (do mvstore commit), unless your WRITE_DELAY=0, and H2 will slow down.
If you want to somewhat mimic H2, dont issue  MVStore.commit(), because it has nothing to do with db commit.
Reply all
Reply to author
Forward
0 new messages