Impact of Disabling Sync-Log

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关于关闭sync-log 相关影响

| username: jeff

【TiDB Usage Environment】Production Environment
【TiDB Version】4.0.13
【Encountered Problem: Problem Description and Impact】
Is there any documentation about sync-log? How does the system operate when this parameter is disabled?
【Attachments: Screenshots/Logs/Monitoring】

| username: WalterWj | Original post link

If it’s an NVMe drive, turning it off won’t improve performance. Just don’t turn off this parameter.

| username: redgame | Original post link

The documentation for version 4.0 is no longer available. This is for version 5.0.

[storage]

Set to true (default value) to ensure reliability and make sure binlog data is flushed to disk

sync-log = true

| username: TiDBer_小阿飞 | Original post link

When sync_log is enabled in TiDB, disk IO utilization can exceed 90%. After setting sync_log to false, it drops to 1%. TiDB is based on the Raft consensus algorithm, which requires ensuring that each raft log is persistently saved to the majority of disks before being committed. To ensure log persistence, we need two steps: writing (log_fd, log) and fsync(log_fd). When sync_log is set to false, TiDB skips fsync, which helps improve performance and is safe as long as there is no power outage. Setting it to true ensures that data remains intact even in the event of a power outage.

| username: Kongdom | Original post link

In the strictest sync-log = true data availability mode, how is the write performance?

Generally speaking, enabling sync-log will result in a performance loss of about 30%. For performance metrics with sync-log disabled, please refer to the TiDB Sysbench Performance Test Report.