Is LevelDB batching writes or is there something more interesting going on?
Is LevelDB batching writes or is there something more interesting going on?
And that is exactly what LevelDB is doing: writing a log (sequential), and when the memorychunk is full, it is writing it to disk sorted (this is also sequential).
Yes, updates can be done in one atomic batch. Please correct me if I'm wrong, but I don't think Tokyo Cabinet allows it without Tokyo Tyrant.
You turn off write-through caching on disks when you run a database unless you are willing to accept corruption (which is worse than data loss) on power outage. And that's why you can't get acceptable write performance out of database without a battery-backed RAID controller (or something other kind of RAM-based write cache with a battery backup).
Here's a simple way to test # fsyncs/s (a.k.a. commit rate) on your system:
sysbench --test=fileio --file-fsync-freq=1 --file-num=1 \
--file-total-size=16384 --file-test-mode=rndwr run --max-time=10 \
| grep "Requests/sec"Also, do you really mean turn off write-through, or did you mean write-behind? (I can't see how write-through would cause corruption, but maybe I'm missing something...)
Also, I wouldn't be surprised if there's a discrepancy in the flushing code across systems. God knows flushing a file to disk in cross-platform code is an arcane science :)
And finally, as somebody else pointed out, LevelDB seems to order write access sequentially as much as possible.