baidu / braft

An industrial-grade C++ implementation of RAFT consensus algorithm based on brpc, widely used inside Baidu to build highly-available distributed systems.
Apache License 2.0
3.99k stars 886 forks source link

add raft_sync_per_bytes flag #348

Closed lintanghui closed 2 years ago

lintanghui commented 2 years ago

添加raft_sync_per_bytes用于及时刷新page cache到磁盘,通常在吞吐高以及在对数据一致性要求不是非常高的场景下可以关闭raft_sync, 但是当吞吐高的时候如果关闭了raft_sync, 当脏页比例超过dirty_ratio时,会导致进程卡住等待flush 脏页引起抖动,通过设置raft_sync_per_bytes 一方面可以避免写入刷脏页抖动,另一方面可以减少宕机情况下可能丢失的数据。