Brian's Waste of Time

Thu, 26 Apr 2007

H2 Performance... "Notes"

This needs to be highlighted. Thomas Mueller, the creator of H2, likes to point out the huge performance difference between H2 and other databases. It is extremely important to note that the main driver behind the performance difference is the fact that H2 explicitely forgoes durability. It does not sync data to disk on commit. Bears repeating, H2 does not sync data to disk on commit. You can force it to, in which case the performance hits the same bottleneck every other database hits, disk io:

-- 1024 bytes, 1000 times --
    derby:		2192 millis
    bdb:		1849 millis
    h2: 		2221 millis
    h2b:		2351 millis
-- 2048 bytes, 1000 times --
    derby:		2199 millis
    bdb:		2129 millis
    h2: 		2578 millis
    h2b:		2414 millis

The numbers here are running simple inserts and deletes by identity (so that I can include BDB JE). Shockingly, the numbers are all basically the same once you force H2 to sync to disk (executing a "CHECKPOINT SYNC" statement after every DML operation).

H2 is an awesome little database, but if you care about storing your data, please read the fine print where it notes that H2 is not ACID. It is just ACI.

10 writebacks [/src/java] permanent link