SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Double Sync Replication
——Enhancing Data Durability
Lixun Peng @ Alibaba Cloud Compute
About me
• Name: Lixun Peng
• Location: Hangzhou, China
• Occupation: Staff Database Kernel Engineer @ Alibaba Cloud
• Interests: MySQL Replication & InnoDB
• Experience:
In the first, I worked as a DBA
Then, I began to modify code, in order to better use
Gradually I became a MySQL Kernel Engineer
Agenda
• The problem about Async/Semi-Sync
• How to solve these problems
• How to implement Double-Sync
• How to use Double-Sync
• Several cases
Agenda
• The problem about Async/Semi-Sync
• How to solve these problems
• How to implement Double-Sync
• Several cases
Problem of Async Replication
• Master doesn’t have to wait ACK from Slave.
• Slave doesn’t know if it dumps the latest binary logs.
• When Master crashes, slave can’t tell if it catches up Master.
• The major problem is slave doesn’t know master’s status.
Semi-Sync Replication
Semi-Sync will wait for
the ACK from Slave
Problem of SemiSync
• Master has to wait ACK from slave.
• Slave will downgrade to async when timeout happens.
• If timeout setting is too small, timeout happens too often.
• If timeout setting is too big, master blocks a lot.
• Slave dump binary logs generated during timeout
asynchronously, after it recover from network failure.
• If Master crashes, slave doesn’t know how replication works
(Async or SemiSync).
• In this case, slave still doesn’t know if it dumps the latest
binary logs.
• Conclusion is SemiSync doesn’t solve the major problem .
Problem of Async/SemiSync
Flow Chart (Async/Semi-Sync)
Background & Target
• Background
• SA team guarantee the server availability: 99.999%
• Net Ops team guarantee the network availability: 99.999%
• Assuming master and network doesn’t fail at the same time.
• Target
• Slave knows if it catch up master.
• Slave knows how data in master side it doesn’t have.
• Key Point: Clarify Slave's status!
Agenda
• The problem about Async/Semi-Sync
• How to solve these problems
• How to implement Double-Sync
• Several cases
Solve the weak point of SemiSync
• Even network recover after failure, slave still has to dump the
binary logs generated during timeout asynchronously.
• If timeout happens and slave gives up the binary logs generated
during timeout, what will happen afterwards if master only send the
latest position & logs?
• When network is down, slave always knows the latest position.
• Slave can know if its data is the same with Master or not.
• How to catch up data modification when network is down?
• Async replication can still dump binary logs
• So we can use Async replication to do a full log apply.
Combine the Async and SemiSync
• Async Replication (Async Channel)
• Dumping continuous binary logs from master.
• Applying logs immediately after slave receives them.
• SemiSync Replication(Sync Channel)
• Dumping the latest binary logs and position.
• Not applying logs immediately. Expired logs are being purged
automatically.
• Analyzing Consistency
• Comparing logs and position from two channels.
Combine the Async and SemiSync
Flow Chart (Double Sync)
Agenda
• The problem about Async/Semi-Sync
• How to solve these problems
• How to implement Double-Sync
• Several cases
How to create two channels(1)
• Multi-Source replication enables N channels in one slave.
• Problem: when master received two dump requests from the
same server-id servers, it disconnects the previous one.
• Solution: set up special Server-ID (0xFFFFFF) for Sync Channel.
How to create two channels (2)
• Problem: there are a SemiSync and a non-SemiSync Channel
in one slave, but the SemiSync settings are global.
• Solution: move SemiSyncSlave class to Master_info.
Analyzing consistency
• Using the GTID
• Using the Log_file_name and Log_file_pos
• Learn the process by checking the following pictures J
Analyzing consistency
ß Needn’t Repair, Just use it!
ß Can’t Repair, Will lose something
ß Can Repair, Use it after repair
Agenda
• The problem about Async/Semi-Sync
• How to solve these problems
• How to implement Double-Sync
• Several cases
CASE 1: Needn’t Fix
• The GTID between Sync and Async Channel are the same.
CASE 2: Can’t Fix
• Exists broken gap between Sync and Async Channel.
CASE 3: Can Repair
• Combine two channel’s logs to make logs continuous.
How to Repair
• Slave waits for the Async Channel to apply all the logs it
receives, then start the SQL THREAD of Sync Channel.
• GTID filters the events which have been applied by Async
Channel.
• A REPAIR SLAVE command is provided to do things
automatically.
FAQs (1)
• Q1: Will Alibaba release this feature?
• A1: Of course! Alibaba will release all the patches.
• Q2: When Alibaba release the source codes?
• A2: Check AliSQL’s roadmap.
• Q3: How can I access AliSQL’s source codes?
• A3: https://github.com/alibaba/AliSQL Currently the project is
private. If you want to access it, please email me to provide
your GitHub account.
FAQs (2)
• Q4: What’s the difference between 2 Semi-Sync Slaves and
double sync replication?
• A4: In fact they do the same job. Performance is pretty much
the same too. But double sync replication saves one more
slave than 2 Semi-Sync Slaves architecture. When the number
of MySQL servers grows, it will save lots of money.
Any other Questions?
penglixun@gmail.com

Más contenido relacionado

La actualidad más candente

What's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech TalkWhat's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech TalkRed Hat Developers
 
Multi-master, multi-region MySQL deployment in Amazon AWS
Multi-master, multi-region MySQL deployment in Amazon AWSMulti-master, multi-region MySQL deployment in Amazon AWS
Multi-master, multi-region MySQL deployment in Amazon AWSContinuent
 
Building a derived data store using Kafka
Building a derived data store using KafkaBuilding a derived data store using Kafka
Building a derived data store using KafkaVenu Ryali
 
Apache Curator: Past, Present and Future
Apache Curator: Past, Present and FutureApache Curator: Past, Present and Future
Apache Curator: Past, Present and FutureJordan Zimmerman
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKAJohan Edstrom
 
Developing Microservices with Apache Camel
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache CamelClaus Ibsen
 
Real time dashboards with Kafka and Druid
Real time dashboards with Kafka and DruidReal time dashboards with Kafka and Druid
Real time dashboards with Kafka and DruidVenu Ryali
 
High Availability in GCE
High Availability in GCEHigh Availability in GCE
High Availability in GCECarmen Mason
 
AWS multi-region DB design and deployment
AWS multi-region DB design and deploymentAWS multi-region DB design and deployment
AWS multi-region DB design and deploymentSudheer Kondla
 
Apache development with GitHub and Travis CI
Apache development with GitHub and Travis CIApache development with GitHub and Travis CI
Apache development with GitHub and Travis CIJukka Zitting
 
What's new in MySQL 5.5? FOSDEM 2011
What's new in MySQL 5.5? FOSDEM 2011What's new in MySQL 5.5? FOSDEM 2011
What's new in MySQL 5.5? FOSDEM 2011Lenz Grimmer
 
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)Lenz Grimmer
 
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015 Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015 Mariano Gonzalez
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusClaus Ibsen
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeRoland Kuhn
 
Serverless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on KubernetesServerless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on KubernetesClaus Ibsen
 
Percona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPercona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPythian
 
Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data storesTomas Doran
 
#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3Twan van den Broek
 
MySQL Multi-Master Replication
MySQL Multi-Master ReplicationMySQL Multi-Master Replication
MySQL Multi-Master ReplicationMichael Naumov
 

La actualidad más candente (20)

What's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech TalkWhat's new with Apache Camel 3? | DevNation Tech Talk
What's new with Apache Camel 3? | DevNation Tech Talk
 
Multi-master, multi-region MySQL deployment in Amazon AWS
Multi-master, multi-region MySQL deployment in Amazon AWSMulti-master, multi-region MySQL deployment in Amazon AWS
Multi-master, multi-region MySQL deployment in Amazon AWS
 
Building a derived data store using Kafka
Building a derived data store using KafkaBuilding a derived data store using Kafka
Building a derived data store using Kafka
 
Apache Curator: Past, Present and Future
Apache Curator: Past, Present and FutureApache Curator: Past, Present and Future
Apache Curator: Past, Present and Future
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKA
 
Developing Microservices with Apache Camel
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache Camel
 
Real time dashboards with Kafka and Druid
Real time dashboards with Kafka and DruidReal time dashboards with Kafka and Druid
Real time dashboards with Kafka and Druid
 
High Availability in GCE
High Availability in GCEHigh Availability in GCE
High Availability in GCE
 
AWS multi-region DB design and deployment
AWS multi-region DB design and deploymentAWS multi-region DB design and deployment
AWS multi-region DB design and deployment
 
Apache development with GitHub and Travis CI
Apache development with GitHub and Travis CIApache development with GitHub and Travis CI
Apache development with GitHub and Travis CI
 
What's new in MySQL 5.5? FOSDEM 2011
What's new in MySQL 5.5? FOSDEM 2011What's new in MySQL 5.5? FOSDEM 2011
What's new in MySQL 5.5? FOSDEM 2011
 
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
 
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015 Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015
Zero Downtime with OSGi - Chicago Coder Conference 05-15-2015
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
 
Serverless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on KubernetesServerless integration with Knative and Apache Camel on Kubernetes
Serverless integration with Knative and Apache Camel on Kubernetes
 
Percona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPercona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWS
 
Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data stores
 
#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3
 
MySQL Multi-Master Replication
MySQL Multi-Master ReplicationMySQL Multi-Master Replication
MySQL Multi-Master Replication
 

Similar a Double Sync Replication

Alibaba patches in MariaDB
Alibaba patches in MariaDBAlibaba patches in MariaDB
Alibaba patches in MariaDBLixun Peng
 
Pluk2013 bodybuilding ratheesh
Pluk2013 bodybuilding ratheeshPluk2013 bodybuilding ratheesh
Pluk2013 bodybuilding ratheeshRatheesh Kaniyala
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await ExplainedJeremy Likness
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentOrkhan Gasimov
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
 
Cinder enhancements-for-replication-using-stateless-snapshots
Cinder enhancements-for-replication-using-stateless-snapshotsCinder enhancements-for-replication-using-stateless-snapshots
Cinder enhancements-for-replication-using-stateless-snapshotsCaitlin Bestler
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3Marco Tusa
 
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your Data
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your DataTraining Slides: 102 - Basics - Tungsten Replicator - How We Move Your Data
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your DataContinuent
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Sql server logshipping
Sql server logshippingSql server logshipping
Sql server logshippingZeba Ansari
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)Panagiotis Kanavos
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsSveta Smirnova
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deploymentAbhishek Singh
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerkuchinskaya
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 

Similar a Double Sync Replication (20)

Alibaba patches in MariaDB
Alibaba patches in MariaDBAlibaba patches in MariaDB
Alibaba patches in MariaDB
 
Pluk2013 bodybuilding ratheesh
Pluk2013 bodybuilding ratheeshPluk2013 bodybuilding ratheesh
Pluk2013 bodybuilding ratheesh
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await Explained
 
Fault Tolerance in Distributed Environment
Fault Tolerance in Distributed EnvironmentFault Tolerance in Distributed Environment
Fault Tolerance in Distributed Environment
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
Cinder enhancements-for-replication-using-stateless-snapshots
Cinder enhancements-for-replication-using-stateless-snapshotsCinder enhancements-for-replication-using-stateless-snapshots
Cinder enhancements-for-replication-using-stateless-snapshots
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your Data
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your DataTraining Slides: 102 - Basics - Tungsten Replicator - How We Move Your Data
Training Slides: 102 - Basics - Tungsten Replicator - How We Move Your Data
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Sql server logshipping
Sql server logshippingSql server logshipping
Sql server logshipping
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAs
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemaker
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 

Más de Lixun Peng

MySQL新技术探索与实践
MySQL新技术探索与实践MySQL新技术探索与实践
MySQL新技术探索与实践Lixun Peng
 
阿里云RDS for MySQL的若干优化
阿里云RDS for MySQL的若干优化阿里云RDS for MySQL的若干优化
阿里云RDS for MySQL的若干优化Lixun Peng
 
DoubleBinlog方案
DoubleBinlog方案DoubleBinlog方案
DoubleBinlog方案Lixun Peng
 
MySQL优化、新特性和新架构 彭立勋
MySQL优化、新特性和新架构 彭立勋MySQL优化、新特性和新架构 彭立勋
MySQL优化、新特性和新架构 彭立勋Lixun Peng
 
对MySQL应用的一些总结
对MySQL应用的一些总结对MySQL应用的一些总结
对MySQL应用的一些总结Lixun Peng
 
对MySQL的一些改进想法和实现
对MySQL的一些改进想法和实现对MySQL的一些改进想法和实现
对MySQL的一些改进想法和实现Lixun Peng
 
MySQL多机房容灾设计(with Multi-Master)
MySQL多机房容灾设计(with Multi-Master)MySQL多机房容灾设计(with Multi-Master)
MySQL多机房容灾设计(with Multi-Master)Lixun Peng
 
Performance of fractal tree databases
Performance of fractal tree databasesPerformance of fractal tree databases
Performance of fractal tree databasesLixun Peng
 
MySQL新技术探索与实践
MySQL新技术探索与实践MySQL新技术探索与实践
MySQL新技术探索与实践Lixun Peng
 
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复MySQL源码分析.03.InnoDB 物理文件格式与数据恢复
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复Lixun Peng
 
MySQL源码分析.02.Handler API
MySQL源码分析.02.Handler APIMySQL源码分析.02.Handler API
MySQL源码分析.02.Handler APILixun Peng
 
MySQL源码分析.01.代码结构与基本流程
MySQL源码分析.01.代码结构与基本流程MySQL源码分析.01.代码结构与基本流程
MySQL源码分析.01.代码结构与基本流程Lixun Peng
 
内部MySQL培训.3.基本原理
内部MySQL培训.3.基本原理内部MySQL培训.3.基本原理
内部MySQL培训.3.基本原理Lixun Peng
 
内部MySQL培训.2.高级应用
内部MySQL培训.2.高级应用内部MySQL培训.2.高级应用
内部MySQL培训.2.高级应用Lixun Peng
 
内部MySQL培训.1.基础技能
内部MySQL培训.1.基础技能内部MySQL培训.1.基础技能
内部MySQL培训.1.基础技能Lixun Peng
 
对简易几何机械化证明的进一步研究
对简易几何机械化证明的进一步研究对简易几何机械化证明的进一步研究
对简易几何机械化证明的进一步研究Lixun Peng
 
A binary graphics recognition algorithm based on fitting function
A binary graphics recognition algorithm based on fitting functionA binary graphics recognition algorithm based on fitting function
A binary graphics recognition algorithm based on fitting functionLixun Peng
 
一种基于拟合函数的图形识别算法
一种基于拟合函数的图形识别算法一种基于拟合函数的图形识别算法
一种基于拟合函数的图形识别算法Lixun Peng
 
中文分词算法设计
中文分词算法设计中文分词算法设计
中文分词算法设计Lixun Peng
 
Database.Cache&Buffer&Lock
Database.Cache&Buffer&LockDatabase.Cache&Buffer&Lock
Database.Cache&Buffer&LockLixun Peng
 

Más de Lixun Peng (20)

MySQL新技术探索与实践
MySQL新技术探索与实践MySQL新技术探索与实践
MySQL新技术探索与实践
 
阿里云RDS for MySQL的若干优化
阿里云RDS for MySQL的若干优化阿里云RDS for MySQL的若干优化
阿里云RDS for MySQL的若干优化
 
DoubleBinlog方案
DoubleBinlog方案DoubleBinlog方案
DoubleBinlog方案
 
MySQL优化、新特性和新架构 彭立勋
MySQL优化、新特性和新架构 彭立勋MySQL优化、新特性和新架构 彭立勋
MySQL优化、新特性和新架构 彭立勋
 
对MySQL应用的一些总结
对MySQL应用的一些总结对MySQL应用的一些总结
对MySQL应用的一些总结
 
对MySQL的一些改进想法和实现
对MySQL的一些改进想法和实现对MySQL的一些改进想法和实现
对MySQL的一些改进想法和实现
 
MySQL多机房容灾设计(with Multi-Master)
MySQL多机房容灾设计(with Multi-Master)MySQL多机房容灾设计(with Multi-Master)
MySQL多机房容灾设计(with Multi-Master)
 
Performance of fractal tree databases
Performance of fractal tree databasesPerformance of fractal tree databases
Performance of fractal tree databases
 
MySQL新技术探索与实践
MySQL新技术探索与实践MySQL新技术探索与实践
MySQL新技术探索与实践
 
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复MySQL源码分析.03.InnoDB 物理文件格式与数据恢复
MySQL源码分析.03.InnoDB 物理文件格式与数据恢复
 
MySQL源码分析.02.Handler API
MySQL源码分析.02.Handler APIMySQL源码分析.02.Handler API
MySQL源码分析.02.Handler API
 
MySQL源码分析.01.代码结构与基本流程
MySQL源码分析.01.代码结构与基本流程MySQL源码分析.01.代码结构与基本流程
MySQL源码分析.01.代码结构与基本流程
 
内部MySQL培训.3.基本原理
内部MySQL培训.3.基本原理内部MySQL培训.3.基本原理
内部MySQL培训.3.基本原理
 
内部MySQL培训.2.高级应用
内部MySQL培训.2.高级应用内部MySQL培训.2.高级应用
内部MySQL培训.2.高级应用
 
内部MySQL培训.1.基础技能
内部MySQL培训.1.基础技能内部MySQL培训.1.基础技能
内部MySQL培训.1.基础技能
 
对简易几何机械化证明的进一步研究
对简易几何机械化证明的进一步研究对简易几何机械化证明的进一步研究
对简易几何机械化证明的进一步研究
 
A binary graphics recognition algorithm based on fitting function
A binary graphics recognition algorithm based on fitting functionA binary graphics recognition algorithm based on fitting function
A binary graphics recognition algorithm based on fitting function
 
一种基于拟合函数的图形识别算法
一种基于拟合函数的图形识别算法一种基于拟合函数的图形识别算法
一种基于拟合函数的图形识别算法
 
中文分词算法设计
中文分词算法设计中文分词算法设计
中文分词算法设计
 
Database.Cache&Buffer&Lock
Database.Cache&Buffer&LockDatabase.Cache&Buffer&Lock
Database.Cache&Buffer&Lock
 

Último

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Último (20)

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

Double Sync Replication

  • 1. Double Sync Replication ——Enhancing Data Durability Lixun Peng @ Alibaba Cloud Compute
  • 2. About me • Name: Lixun Peng • Location: Hangzhou, China • Occupation: Staff Database Kernel Engineer @ Alibaba Cloud • Interests: MySQL Replication & InnoDB • Experience: In the first, I worked as a DBA Then, I began to modify code, in order to better use Gradually I became a MySQL Kernel Engineer
  • 3. Agenda • The problem about Async/Semi-Sync • How to solve these problems • How to implement Double-Sync • How to use Double-Sync • Several cases
  • 4. Agenda • The problem about Async/Semi-Sync • How to solve these problems • How to implement Double-Sync • Several cases
  • 5. Problem of Async Replication • Master doesn’t have to wait ACK from Slave. • Slave doesn’t know if it dumps the latest binary logs. • When Master crashes, slave can’t tell if it catches up Master. • The major problem is slave doesn’t know master’s status.
  • 6. Semi-Sync Replication Semi-Sync will wait for the ACK from Slave
  • 7. Problem of SemiSync • Master has to wait ACK from slave. • Slave will downgrade to async when timeout happens. • If timeout setting is too small, timeout happens too often. • If timeout setting is too big, master blocks a lot. • Slave dump binary logs generated during timeout asynchronously, after it recover from network failure. • If Master crashes, slave doesn’t know how replication works (Async or SemiSync). • In this case, slave still doesn’t know if it dumps the latest binary logs. • Conclusion is SemiSync doesn’t solve the major problem .
  • 10. Background & Target • Background • SA team guarantee the server availability: 99.999% • Net Ops team guarantee the network availability: 99.999% • Assuming master and network doesn’t fail at the same time. • Target • Slave knows if it catch up master. • Slave knows how data in master side it doesn’t have. • Key Point: Clarify Slave's status!
  • 11. Agenda • The problem about Async/Semi-Sync • How to solve these problems • How to implement Double-Sync • Several cases
  • 12. Solve the weak point of SemiSync • Even network recover after failure, slave still has to dump the binary logs generated during timeout asynchronously. • If timeout happens and slave gives up the binary logs generated during timeout, what will happen afterwards if master only send the latest position & logs? • When network is down, slave always knows the latest position. • Slave can know if its data is the same with Master or not. • How to catch up data modification when network is down? • Async replication can still dump binary logs • So we can use Async replication to do a full log apply.
  • 13. Combine the Async and SemiSync • Async Replication (Async Channel) • Dumping continuous binary logs from master. • Applying logs immediately after slave receives them. • SemiSync Replication(Sync Channel) • Dumping the latest binary logs and position. • Not applying logs immediately. Expired logs are being purged automatically. • Analyzing Consistency • Comparing logs and position from two channels.
  • 14. Combine the Async and SemiSync
  • 16. Agenda • The problem about Async/Semi-Sync • How to solve these problems • How to implement Double-Sync • Several cases
  • 17. How to create two channels(1) • Multi-Source replication enables N channels in one slave. • Problem: when master received two dump requests from the same server-id servers, it disconnects the previous one. • Solution: set up special Server-ID (0xFFFFFF) for Sync Channel.
  • 18. How to create two channels (2) • Problem: there are a SemiSync and a non-SemiSync Channel in one slave, but the SemiSync settings are global. • Solution: move SemiSyncSlave class to Master_info.
  • 19. Analyzing consistency • Using the GTID • Using the Log_file_name and Log_file_pos • Learn the process by checking the following pictures J
  • 20. Analyzing consistency ß Needn’t Repair, Just use it! ß Can’t Repair, Will lose something ß Can Repair, Use it after repair
  • 21. Agenda • The problem about Async/Semi-Sync • How to solve these problems • How to implement Double-Sync • Several cases
  • 22. CASE 1: Needn’t Fix • The GTID between Sync and Async Channel are the same.
  • 23. CASE 2: Can’t Fix • Exists broken gap between Sync and Async Channel.
  • 24. CASE 3: Can Repair • Combine two channel’s logs to make logs continuous.
  • 25. How to Repair • Slave waits for the Async Channel to apply all the logs it receives, then start the SQL THREAD of Sync Channel. • GTID filters the events which have been applied by Async Channel. • A REPAIR SLAVE command is provided to do things automatically.
  • 26. FAQs (1) • Q1: Will Alibaba release this feature? • A1: Of course! Alibaba will release all the patches. • Q2: When Alibaba release the source codes? • A2: Check AliSQL’s roadmap. • Q3: How can I access AliSQL’s source codes? • A3: https://github.com/alibaba/AliSQL Currently the project is private. If you want to access it, please email me to provide your GitHub account.
  • 27. FAQs (2) • Q4: What’s the difference between 2 Semi-Sync Slaves and double sync replication? • A4: In fact they do the same job. Performance is pretty much the same too. But double sync replication saves one more slave than 2 Semi-Sync Slaves architecture. When the number of MySQL servers grows, it will save lots of money.