Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
feature-backlog
-
Security Level: Public
-
None
-
ForestDB: Oct 26 - Nov 13
Description
For users who do not want strict synchronous write, calling fsync() is not necessary but fdb_commit() should be invoked periodically in ForestDB, to flush WAL entries and to append DB header.
It is uncomfortable for users to determine when to call fdb_commit() between consecutive fdb_set() calls. If they call fdb_commit() per each fdb_set(), ForestDB will show the worst performance and the largest write amplification. By contrast, if fdb_commit() is invoked only once after a number of fdb_set() calls, WAL restore procedure will take long time to reconstruct WAL entries when we reopen the DB file.
The best timing to call fdb_commit() is when WAL becomes full (i.e., the number of WAL entries reaches the configured threshold). We can (almost) minimize the write amplification and maximize the write throughput, while restoring WAL entries takes very short time.
Hence, for asynchronous write mode, we need to add an option called 'auto_commit' which is similar to the existing 'wal_flush_before_commit' option. With the auto commit option, when fdb_set() is called and WAL becomes full, fdb_commit() is automatically called so that users do not need to manually call it.