0

In tidb ,when open sync-log ,disk io util can be over 90%,after set sync-log=false,it goes down to 1%,what's the bad effect of this config?

kk.
  • 3,747
  • 12
  • 36
  • 67

1 Answers1

0

In short, sync-log=true keeps data safe, but hurts performance.

TiDB is based on the Raft consensus algorithm, it needs to make sure every raft log is persisted to the majority's disk before committing them. To make sure a log is persisted, we need two steps:

  1. write(log_fd, log)
  2. fsync(log_fd)

When sync-log=false, TiDB skips fsync, it helps performance and is safe if there is no power failure. Set it to true, your data is always intact even if there is a power failure.

See more: https://pingcap.com/docs/v3.0/faq/tidb/

NeilShen
  • 558
  • 6
  • 16