Bitcask with sync_strategy o_sync seem to have no effect

Tatsuya Kawano tatsuya6502 at gmail.com
Tue Aug 30 22:57:11 EDT 2011


Hi,

We're currently evaluating Riak and we have noticed that Bitcask with {sync_strategy, o_sync} option seems to have no effect. Instead of forcing syncs on every writes to the disk, it does the exactly same to the default behavior {sync_strategy, none}, which doesn't force kernel to sync the writes. As you can see in the attached vmstat result, "bo" (blocks sent to a block device [blocks/s]) column has many 0s even though basho_bench with 200 max workers was constantly adding 100KB key-values to Riak.

The current behavior could be dangerous if someone rely on {sync_strategy, o_sync} for durability.

My colleague checked Bitcask implementation and found that it uses "fcntl (2)" system call to set O_SYNC flag to the file descriptor. Unfortunately, O_SYNC being set by this way will be ignored by kernel and has no effect. To make it work, Betcask should call "open" system call with O_SYNC option.

https://patchwork.kernel.org/patch/591481/

Thanks,
Tatsuya


vmstat result. See "bo" column with many 0s (bo: blocks sent to a block device [blocks/s])

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
1  0    152 31796516   4508 933452    0    0     0     0 9797 17377  4  7 89  0  0
1  0    152 31735260   4556 992524    0    0     0     0 9550 16871  4  7 89  0  0
0  5    152 31676856   4608 1045328    0    0     0 58632 9196 15189  4  7 89  1  0
0  0    152 31673880   4636 1056056    0    0     0 188868 2807 2549  1  3 79 18  0
1  0    152 31611752   4704 1111920    0    0     0     0 9332 16648  4  7 89  0  0
0  0    152 31553852   4760 1170592    0    0     0     0 9369 16949  5  7 89  0  0
0  0    152 31494068   4840 1228580    0    0     0     0 9317 16863  4  7 89  0  0
0  4    152 31432936   4908 1283836    0    0     0 47548 8794 15442  4  7 88  1  0
0  0    152 31428348   4940 1293996    0    0     0 191140 3513 2998  1  3 80 17  0
0  0    152 31367708   4988 1351964    0    0     0     0 9745 16114  4  7 89  0  0
2  0    152 31302104   5048 1412876    0    0     0     0 9637 17205  5  7 89  0  0
0  0    152 31244072   5100 1468180    0    0     0     0 9405 16214  4  7 89  0  0
0  5    152 31184428   5168 1522604    0    0     0 47856 8983 16001  4  7 88  1  0
0  0    152 31179256   5192 1533648    0    0     0 191968 3030 3099  1  3 87 10  0
2  0    152 31123316   5256 1588244    0    0     0    52 9548 16022  4  7 89  0  0
1  0    152 31061068   5308 1648228    0    0     0     0 9319 17110  5  7 88  0  0
2  0    152 30997704   5368 1708092    0    0     0     0 9423 17373  5  7 88  0  0
0  3    152 30941664   5420 1760988    0    0     0 42728 8871 15132  4  7 89  1  0
0  0    152 30934964   5440 1774016    0    0     0 196216 3282 3489  1  3 80 17  0
0  0    152 30886472   5496 1820728    0    0     0    52 7654 13882  4  6 91  0  0
0  0    152 30886472   5496 1820612    0    0     0     0 1006  107  0  0 100  0  0
0  0    152 30886208   5496 1821156    0    0     0     0 1050  150  0  0 100  0  0

--
Tatsuya Kawano (Mr.)
Tokyo, Japan





More information about the riak-users mailing list