Distribution Writer 调用Statement Delivery 存储过程,将Publication的改变同步到Subscriber中。查看Publication Properties->Ariticle Properties->Statement Delivery 属性,Distribution Writer调用Insert,Update 或 Delete 存储过程,实现数据的同步。

Distribution Writer不是每一个Command单独提交,而是根据CommitBatchSize 和CommitBatchThreshold来批量提交Commands,这样可以提高性能。

-CommitBatchSize commit_batch_size Is the number of transactions to be issued to the Subscriber before a COMMIT statement is issued. The default is 100.

-CommitBatchThreshold  commit_batch_threshold Is the number of replication commands to be issued to the Subscriber before a COMMIT statement is issued. The default is 1000.

一般情况下,Distribution Writer的写入速度十分快,很少出现 Latency Problem。如果出现PageIOLatch_EX 或  PageIOLatch_SH 等待,请参考《Latch2:Latch和性能》:

PAGEIOLATCH_SH 发生在用户访问一个数据页,同时SQL Server正在将数据页从磁盘写入内存,经常发生PAGEIOLATCH_SH等待,说明内存不够大,导致SQL Server需要做很多页面读取的操作,磁盘IO是内存压力的副作用。

PAGEIOLATCH_EX:发生在从Disk page读取到内存buffer中,经常发生PAGEIOLATCH_EX等待,说明Disk读取速度慢,这和内存没直接关系。

Appendix:

引用《Transactional Replication Conversations》:

Distribution Writer thread writing queue commands to the Subscriber via parameterized stored procedures prefixed with sp_MSupd…, sp_MSins…, sp_MSdel… to apply individual row changes to each article at the subscriber.

The Writer-Thread calls Replication created stored procedures to apply changes to the subscriber.  These sp’s rely on a user table’s unique index (usually primary key) to locate records to be updated or deleted.  Latency in the Writer thread is usually see in long-running execution time for these stored procedures.

Possible Cause: Not Replicating SQL statements as “Parameters”

Obtain the create publication script and check ALL articles to see if the SQL statements are being sent as batch of ‘parameters’ statements.  The status = 8 indicates ‘parameters’ batching is not enabled.

查看Article的Status,推荐将Status设置为25。

select artid,
    name,
    objid,
    pubid,
    status
from dbo.sysarticles

Satus:The bitmask of the article options and status, which can be the bitwise logical OR result of one or more of these values:

1 = Article is active.

8 = Include the column name in INSERT statements.

16 = Use parameterized statements.

24 = Both include the column name in INSERT statements and use parameterized statements.

64 = Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

For example, an active article using parameterized statements would have a value of 17 in this column. A value of 0 means that the article is inactive and no additional properties are defined.

Article status can be updated on-demand using the following Replication stored procedure.  This should be executed on all articles.

USE [Publisher_database]
GO

exec [sys].[sp_changearticle]
    @publication    sysname = NULL,
    @article        sysname = NULL,
    ) = NULL,
    ) = NULL

参考doc:

Transactional Replication Conversations

事务复制会话 (五)

事务复制会话 (四)

sysarticles (Transact-SQL)

Distribution2:Distribution Writer的更多相关文章

  1. Distribution1:Distribution Reader

    在transactional replication中,在publication中执行了一个更新,例如:update table set col=? Where ?,如果table中含有大量的数据行, ...

  2. Replication:Distribution Reader

    在transactional replication中,在publication中执行了一个更新,例如:update table set col=? Where ?,如果table中含有大量的数据行, ...

  3. 2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D:Distribution in Metagonia(构造)

    http://codeforces.com/gym/100801/attachments 题意:给出一个数n(1 <= n <= 1e18),将 n 拆成 m 个整数,其中 m 必须是 2 ...

  4. Replication:distribution 中一直在运行 waitfor delay @strdelaytime 语句

    Replication 自动创建来一个 Job:Replication monitoring refresher for distribution,这个Agent执行一个sp: dbo.sp_repl ...

  5. IPC 经典问题:Reader & Writer Problem

    完整代码实现: #include <stdio.h> #include <unistd.h> #include <time.h> #include <stdl ...

  6. Gym - 100801D:Distribution in Metagonia (数学)

    题意:给定一个N,让你把它拆成若干个只含素因子2和3的数之和,且两两之间没有倍数关系,比如10=4+6. 思路:即是2因子的幂递增,3因子的幂递减:或者反之. 对于当前N,我们拆分出的数为num=2^ ...

  7. Scalaz(13)- Monad:Writer - some kind of logger

    通过前面的几篇讨论我们了解到F[T]就是FP中运算的表达形式(representation of computation).在这里F[]不仅仅是一种高阶类型,它还代表了一种运算协议(computati ...

  8. 杂项-桌面应用程序:Windows Live Writer(WLW)

    ylbtech-杂项-桌面应用程序:Windows Live Writer(WLW) Windowslive Writer 即(WLW) 是一个免费的桌面应用程序,您可以使用它轻松发布丰富的内容到您的 ...

  9. DevExpress应用案例--语音识别器Dual Writer

    Dual Writer是 一个以语音识别为特色的文档处理器,无需安装其他软件,只需要插入你的麦克风就可以开始录入口述文字.它不仅支持MS Word的DOCX格式,还支持 RTF.ODT.TXT等常见文 ...

随机推荐

  1. 可变参数列表与printf()函数的实现

    问题 当我们刚开始学习C语言的时候,就接触到printf()函数,可是当时"道行"不深或许不够细心留意,又或者我们理所当然地认为库函数规定这样就是这样,没有发现这个函数与普通的函数 ...

  2. 第一天ci框架开发商城2

    ci框架开发商城2 1/28/2016 9:45:52 PM mvc完整案例 mvc完成新闻的增删改查 news控制器news.php class News extends CI_controller ...

  3. 已知服务器ftp的账号密码,求解数据库表的内容

    一开始觉得这两个是完全不相干的东西,直到出现了这样一个问题,对方网站只有ftp的账号密码,并且能正常访问到代码.但是当需求了解注册人数的时候,后台没有显示,只能到数据库去找,这时怎么找呢? 原来是可以 ...

  4. [BZOJ4200][Noi2015]小园丁与老司机

    4200: [Noi2015]小园丁与老司机 Time Limit: 20 Sec  Memory Limit: 512 MBSec  Special JudgeSubmit: 106  Solved ...

  5. React-native之Alert

    普通的alert 先看函数原型 alert: (title: string, message?: string, buttons?: AlertButton[], type?: string) =&g ...

  6. MAC帧和IP包的分析

    ping了12次岭南师范学院官网后退出   抓到的包如下   各个名词解释

  7. C# base64 Img 互转

    [AcceptVerbs(HttpVerbs.Post)] public JsonResult Upload(HttpPostedFileBase fileData) { try { if (file ...

  8. lua 时间戳和时间互转

    1.时间戳转换成时间 local t = 1412753621000 function getTimeStamp(t)     return os.date("%Y%m%d%H", ...

  9. php中redis的安装

    1.当你在使用php时出现下面的问题 2.通过phpinfo()查看php的版本 我的是php5.6版本 3.查看需要下载的redis的版本 4.点击下面的额链接下载redis:http://wind ...

  10. SQL——行值表达式(Row Value Expressions)

    概述 最近接触了一个新概念——行值表达式,也叫做行值构造器.这是一个很强大的SQL功能,通常我们所操作的SQL表达式都只能针对一行中的单一字段进行操作比较,而行值表达式可以针对一行中的多个字段进行操作 ...