mmap based writing vs. stdio based writing

648 views
Skip to first unread message

Flabby

unread,
Mar 18, 2016, 8:55:24 AM3/18/16
to leveldb
Hi,
     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?

     Thanks.
   

Robert Escriva

unread,
Mar 18, 2016, 11:22:22 AM3/18/16
to lev...@googlegroups.com
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
version.

-Robert
Reply all
Reply to author
Forward
0 new messages