- CommitBatchSize “Is the number of transactions to be issued to the Subscriber before a COMMIT statement is issued. The default is 100.”
- CommitBatchThreshold “Is the number of replication commands to be issued to the Subscriber before a COMMIT statement is issued. The default is 1000.”
http://kendalvandyke.blogspot.com/2008/11/how-commitbatchsize-and.html
根据我自己的分析,这两个属性的作用如下:
- Distrabution Agent 将所有单条命令作为一个单位,CommitBatchThreshold和CommitBatchSize 是以单条命令数为标准
- 如果一个语句更新N条记录,这条语句视为在一个transaction中。但是命令数为N。
- 如果命令在一个transaction中,不考虑CommitBatchSize ,只考虑CommitBatchThreshold。
- 单个transaction不会被拆分成多个,就算单个transaction中的命令数超过CommitBatchThreshold。
- 如果提交多个transaction,第一个transaction 的命令数没有超出CommitBatchThreshold,则第二个transaction 会被合并如第一个。如果合并后的命令数超出CommitBatchThreshold,则不继续合并,但是前两个transactions照样提交。
- 如果命令不在一个transaction中,按照CommitBatchSize的设定将一定数量的命令合并成一个transaction。
- 如果CommitBatchSize的值大于CommitBatchThreshold,一个CommitBatchSize的transaction会被进一步拆分成两个,比如CommitBatchSize=5,CommitBatchThreshold=3,总命令数为10,会如下打包 4,1,4,1。为什么会出现4,请参见第5条,因为第一个包的命令数在向后合并中到第四个命令才超过CommitBatchThreshold。于是一个CommitBatchSize的transaction 被分成两个 4,1。