Xiao, FileChannel.force is fsync on unix.
To force fsync on every message: log.flush.interval.messages=1 You are looking at the time based fsync, which, naturally, as you say, is time-based. -Jay On Fri, Mar 6, 2015 at 11:35 PM, Xiao <lixiao1...@gmail.com> wrote: > Hi, Jay, > > Thank you for your answer. > > Sorry, I still do not understand your meaning. > > I guess the two parameters you mentioned are log.flush.interval and > log.default.flush.interval.ms. However, these two parameters only control > when Kafka issues a flush (i.e., calling FileChannel.force()). > > Fsync (fileOutputStream.getFD().sync()) is controlled by another parameter > log.default.flush.scheduler.interval.ms. > > scheduler.schedule("kafka-recovery-point-checkpoint", > checkpointRecoveryPointOffsets, > delay = InitialTaskDelayMs, > period = flushCheckpointMs, > TimeUnit.MILLISECONDS) > > This thread is only time-controlled. It does not check the number of > messages. > > Thank you, > > Xiao Li > > > On Mar 5, 2015, at 11:59 AM, Jay Kreps <jay.kr...@gmail.com> wrote: > > > Hey Xiao, > > > > That's not quite right. Fsync is controlled by either a time based > criteria > > (flush every 30 seconds) or a number of messages criteria. So if you set > > the number of messages to 1 the flush is synchronous with the write, > which > > I think is what you are looking for. > > > > -Jay > >