mmap based writing vs. stdio based writing

Skip to first unread message


Mar 18, 2016, 8:55:24 AM3/18/16
to leveldb
     I'm wondering that why leveldb use mmap based writing at first, then replace it with stdio based writing.
     According to 1.15 Release Note .  ' Has a   minor impact (0.5 microseconds) on microbenchmarks for asynchronous writes. Synchronous writes speed up from 30ms to 10ms on linux/ext4.'

     1).  I think asynchronous  or synchronous writes means wether to use fsync for the write operation, is it that?
     2).  If so,  I prefer the mmap version,  because asynchronous writes is much more common for my situation, what's your opion?
     Also, I'm new to leveldb benchmark, how can I benchmark this?


Robert Escriva

Mar 18, 2016, 11:22:22 AM3/18/16
There was a bug on OS X where mmap and fsync did not perform as
expected. This caused problems in bitcoin, leading to their famous
leveldb bug bounty. The solution was to change to purely stdio-based
writing so it works on all platforms without relying on Linux behavior.

Neither version implies the use of fsync unless you set sync=true in the
WriteOptions. You can still do asynchronous writes in the newest

Reply all
Reply to author
0 new messages