1 / 24

DTC 介绍 & 设计

DTC 介绍 & 设计. 为什么需要 DTC? 基本概念: DTC,AP,RM,TC,T,P (*)2 Phases Commit 业界方案 : IBM,Oracle,Mysql,Microsoft,Mongodb 设计实现. 1 为什么需要 DTC?. 1 为什么需要 DTC?. 1 为什么需要 DTC?. 1 为什么需要 DTC?. What does Distributed Transaction Coordinator do?

blanca
Download Presentation

DTC 介绍 & 设计

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DTC 介绍 & 设计

  2. 为什么需要DTC? 基本概念:DTC,AP,RM,TC,T,P (*)2 Phases Commit 业界方案:IBM,Oracle,Mysql,Microsoft,Mongodb 设计实现

  3. 1 为什么需要DTC?

  4. 1 为什么需要DTC?

  5. 1 为什么需要DTC?

  6. 1 为什么需要DTC? What does Distributed Transaction Coordinator do? The Distributed Transaction Coordinator (DTC) service coordinates transactions that update two or more transaction-protected resources, such as databases, message queues, files systems, and so on. These transaction-protected resources may be on a single computer or distributed across many networked computers. http://technet.microsoft.com/en-us/library/cc759136(v=ws.10).aspx

  7. 为什么需要DTC? 基本概念:DTC,AP,RM,TC,T,P (*)2 Phases Commit 业界方案: IBM,Oracle,Mysql,Microsoft,Mongodb 设计实现

  8. 2 基本概念:DTC,AP,RM,TC,T,P REF Distributed Transaction Processing:The XA Specification(By Open Group) Two Phase Commit (By Philip A. Bernstein)

  9. 2 基本概念:DTC,AP,RM,TC,T,P REF Distributed Transaction Processing:The XA Specification(By Open Group) Two Phase Commit (By Philip A. Bernstein)

  10. 为什么需要DTC? 基本概念:DTC,AP,RM,TC,T,P (*)2 Phases Commit 业界方案:IBM,Oracle,Mysql,Microsoft,Mongodb 设计实现

  11. 3--2 Phases Commit Transaction Completion and Recovery TMs and RMs use two-phase commit with presumed rollback, as defined by the referenced OSI DTP specification (model). In Phase 1, the TM asks all RMs to prepare to commit(or prepare) transaction branches. This asks whether the RM can guarantee its ability to commit the transaction branch. An RM may have to query other entities internal to that RM. If an RM can commit its work, it records stably the information it needs to do so, then replies affirmatively. A negative reply reports failure for any reason. After making a negative reply and rolling back its work, the RM can discard any knowledge it has of the transaction branch. In Phase 2, the TM issues all RMs an actual request to commit or roll back the transaction branch, as the case may be. (Before issuing requests to commit, the TM stably records the fact that it decided to commit, as well as a list of all involved RMs.) All RMs commit or roll back changes to shared resources and then return status to the TM. The TM can then discard its knowledge of the global transaction. Distributed Transaction Processing:The XA Specification 原文

  12. 为什么需要DTC? 基本概念:DTC,AP,RM,TC,T,P (*)2 Phases Commit 业界方案:IBM,Oracle,Mysql,Microsoft,Mongodb 设计实现

  13. 5—Key Scenarios 关键场景

  14. 5—System Summary 系统架构总览

  15. 5—DTC 架构总览 XA Interface

  16. 5—DTC 架构总览 系统主要工作主要在处理2 Phases Commit 2-phase commit 见上文定义和相关解释

  17. 5—DTC Thread pool线程池设计 Thread pool通过push/pull,以及与worker之间heartbeat方式决定线程池大小 系统极限是多少? 根据OS特性决定,这个版本考虑32bit 基本概念:32bit系统,可用2G内存,每线程占用1M内存,线程数小于2K,64bit?DTC在prepare及commit阶段会需要单个线程对应单个事务/事务分支,这样对系统线程设计提出了较高的要求 Model and Definitions (Distributed Transaction Processing The XA Specification) 我们的系统最大可以维持多少事务?

  18. 5—DTC Self Host Resource Mgr 线程管理算法,空闲线程处理, OS系统资源管理:CPU过高,磁盘可用量,应用程序占用内存量,后续系统需要考虑过载保护

  19. 5—DTC State table & TLOG State table用于存储DTC的各种状态,整个DTP流程中所有状态存取 取都要用到 TLOG用于将State table内容持久化,同时在灾难恢复时将各种状态还原 TLOG的设置直接影响到系统性能

  20. 5—DTC IO thread:ReadIO,WriteIO IO thread 主要是用于控制TLOG读取的性能,和Mysql的IO thread类似设计。 考虑以生产系统的读写性能指标,需要根据机器性能配置 IO thread与其它线程之间需要采用ZMQ Req/Rep模式通讯,或者其它更加快捷模式 默认设计为:4R,4W

  21. 5—DTC SYN & ASY DTC大部分操作都是同步的,有一些操作可采用异步,比如事务完成,系统日志(非TLOG)

  22. 5—DTC Crash Recovery DTC允许在日志中恢复,类似Oracle redo log,主要是将未完成的事务日志读入内存。

  23. 5—DTC 关键事件流—XA Commit

  24. 5—DTC 关键事件流—Rollback

More Related