about mysql sync_binlog

3
sync_binlog & max_binlog_size Dehua Yang 2012-10-09

Upload: dehua-yang

Post on 16-Jul-2015

484 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: About MySQL sync_binlog

sync_binlog & max_binlog_size

Dehua Yang

2012-10-09

Page 2: About MySQL sync_binlog

sync_binlog• Where is the difference between 0,1?

• sync_binlog=0– MySQL just write the binlog into OS buffer

– not use fdatasync(),

– in high concurrent pressure, this value would impact performance when OS flush buffer into disk

• sync_binlog=1• Every sync_binlog writes to the binary log, MySQL will call the

fdatasync() to synchronizes its binary log to disk (autocommit =true)

• A value of 1 is the safest choice , but if MySQL cash, we still lose one binlog event.

• If have a raid battery-backed cache, which makes synchronization very fast

Page 3: About MySQL sync_binlog

max_binlog_size

• Default value is 100M

• Sometimes we would see some binlog file excee the value of max_binlog_size

• Because...

– Your binlog format is RBR

– You have big transcation , and MySQL woundn’t split one transcation into serveral binary logs.