SlideShare a Scribd company logo
Evaluating Data Freshness in Large
Scale Replicated Databases

                          Miguel Araújo and José Pereira




  Partially funded by project ReD - Resilient Database Clusters (PDTC / EIA-EIA / 109044 / 2008)
Introduction
Introduction

• Why replicate?
Introduction

• Why replicate?
  • Replicating data improves fault-tolerance

  • Allows the construction of large scale systems

  • Improves performance
Introduction

• Why replicate?
  • Replicating data improves fault-tolerance

  • Allows the construction of large scale systems

  • Improves performance

• There are different replication protocols:

  • Lazy schemes use separate transactions for execution and propagation

  • Eager schemes distribute updates to replicas in the context of the original updating
    transaction
Introduction

• Why replicate?
  • Replicating data improves fault-tolerance

  • Allows the construction of large scale systems

  • Improves performance

• There are different replication protocols:

  • Lazy schemes use separate transactions for execution and propagation

  • Eager schemes distribute updates to replicas in the context of the original updating
    transaction

• Most database management systems implement lazy master-slave replication

                   The application has to deal with stale data in
                   order to avoid data inconsistency among replicas
Background
 Replication Mechanism




• Replication mechanism of MySQL:

  1. The master records changes to its data in its binary log (these records are
    called binary log events)


  2. The slave copies the master’s binary log events to its own log (relay log)


  3. The slave replays the events in the relay log, applying the changes to its
    own data
Background
 Replication Topologies



• MySQL in particular allows almost any configuration of master and slave, as
  long as each server has at most one master
Background
 Replication Topologies



• MySQL in particular allows almost any configuration of master and slave, as
  long as each server has at most one master




       Master and multiple slaves
Background
 Replication Topologies



• MySQL in particular allows almost any configuration of master and slave, as
  long as each server has at most one master




       Master and multiple slaves


                                                          Chain
Background
Replication Topologies
Background
Replication Topologies




                    Tree
Background
Replication Topologies




   The ring topology is the only one that allows update-
  everywhere replication (if the application does not
  found any conflicts)



                                                           Ring
Background
 Data Freshness




• But... These techniques do not provide data freshness guarantees


• So, asynchronous replication leads to periods of time that copies of the same
  data diverge


• MySQL replication is commonly known as being very fast


• There have not been systematic efforts to characterize data freshness in MySQL
Goal
Goal




   Assessing the impact of replication topology in MySQL,
  towards maximizing scalability and data freshness
Agenda

         Approach



         Experiments
         -   Workload
         -   Setting
         -   Results




         Conclusions
Measuring Propagation Delay
 Approach




• Our approach is based on using a centralized probe

  • It periodically query each of the replicas, thus discovering what has been
    the last update applied

  • By comparing such positions, it should be possible to discover the
    propagation delay



  There are however several challenges that have to be tackled to obtain
 correct results:
Measuring Propagation Delay
Approach
Measuring Propagation Delay
 Approach



• Measuring updates
Measuring Propagation Delay
  Approach



• Measuring updates


• Non-simultaneous probing


     Problem: cannot probe master and slave
     simultaneously, so readings are not comparable

!"#$%&




'(")%




!*+,$*&
Measuring Propagation Delay
  Approach



• Measuring updates
                                                      Solution: interpolate with a line the time-log position
                                                      values of the master and then compare each replica
• Non-simultaneous probing                            value point with it. At the end, calculate the average


     Problem: cannot probe master and slave
     simultaneously, so readings are not comparable                                          !
                                                                                                     "




                                                          ."/)&"#0,0"1
                                                                                         !
!"#$%&                                                                                           "
                                                                                 !
                                                                                #$%&'( "
                                                                              !    "
                                                                         !
'(")%                                                                        "                   !)*)%$#,(-
                                                                                                 ")*)#'$+(

!*+,$*&                                                                           20%(
Measuring Propagation Delay
Approach
Measuring Propagation Delay
 Approach



• Eliminating quiet periods




                         Problem: sampling twice without updates
                         erroneously biases the estimate
               !"#$%&




               '(")%




               !*+,$*&
Measuring Propagation Delay
 Approach



• Eliminating quiet periods

                                               Solution: select periods where line segments from
                                               both replicas have a positive slope




                         Problem: sampling twice without updates
                         erroneously biases the estimate
               !"#$%&




               '(")%




               !*+,$*&
Measuring Propagation Delay
 Approach



• Eliminating quiet periods
Measuring Propagation Delay
 Approach



• Eliminating quiet periods


• Dealing with variability
Measuring Propagation Delay
 Approach



• Eliminating quiet periods


• Dealing with variability



                  Solution: consider a sufficient amount of samples and
                  assume that each probe happens after half of the observed
                  round-trip
Experiments
 Workload




• We have chosen the workload model defined by TPC-C benchmark


• TPC-C is composed mostly by update intensive transactions


• The master server is almost entirely dedicated to update transactions even in
  a small scale experimental setting, mimicking what would happen in a very
  large scale MySQL setup


• Each client is attached to a database server and produces a stream of
  transaction requests
Experiments
 Setting


• Two replication schemes were installed and configured. A five machine topology of master and
  multiple slaves, and a five machine topology in daisy chain


• All machines are connected through a LAN, and are named PD01 to PD06. Being PD01 the
  master instance, PD04 the remote machine in which interrogation client executed, and the
  others the slave instances


                                                   Machines: HP’s - lab SO

                                                   OS: Linux Ubuntu Server 2.6.31-14
       ✓ 20 clients
                                                   CPU: 2 Intel(R) Core(TM)2 CPU 6400 - 2.13GHz
                        ✓ 80 clients
       ✓ 40 clients                                MEM: 1 GB
                        ✓ 100 clients              DBMS: MySQL 5.1.39
       ✓ 60 clients                                Scale Factor(warehouses): 2

                                                   Duration: 20 minutes
Results

• Results for the different number of TPC-C clients on the master and multiple slaves topology



                                                 PD02    PD03             PD05    PD06
                                         11000

                                         9900

                                         8800

                                         7700
                    Delay Average (µs)




                                         6600

                                         5500

                                         4400

                                         3300

                                         2200

                                         1100

                                             0

                                                   20   40         60       80   100

                                                                Clients
Results

• Results for the different number of TPC-C clients on the chain topology



                                                 PD02        PD03         PD05     PD06
                                         32000

                                         28800

                                         25600

                                         22400
                    Delay Average (µs)




                                         19200

                                         16000

                                         12800

                                          9600

                                          6400

                                          3200

                                            0

                                                  20    40          60     80    100

                                                                Clients
Conclusions
Conclusions


 We were able to measure freshness accurately and with a realistic workload
Conclusions


 We were able to measure freshness accurately and with a realistic workload


 Results show how much:
Conclusions


 We were able to measure freshness accurately and with a realistic workload


 Results show how much:

• Delay grows with workload
• Delay grows with number of replicas attached
• Delay grows with number of hops
Conclusions


 We were able to measure freshness accurately and with a realistic workload


 Results show how much:

 • Delay grows with workload
 • Delay grows with number of replicas attached
 • Delay grows with number of hops


 The conclusion is that the scalability of MySQL using its replication
mechanism is limited when data freshness is a concern
Questions?



             Thank you

More Related Content

Similar to Evaluating Data Freshness in Large Scale Replicated Databases

Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
Xavier Llorà
 
Measuring Docker Performance: what a mess!!!
Measuring Docker Performance: what a mess!!!Measuring Docker Performance: what a mess!!!
Measuring Docker Performance: what a mess!!!
Emiliano
 
Usenix LISA 2012 - Choosing a Proxy
Usenix LISA 2012 - Choosing a ProxyUsenix LISA 2012 - Choosing a Proxy
Usenix LISA 2012 - Choosing a Proxy
Leif Hedstrom
 
Capacity Planning for fun & profit
Capacity Planning for fun & profitCapacity Planning for fun & profit
Capacity Planning for fun & profit
Rodrigo Campos
 
magellan_mongodb_workload_analysis
magellan_mongodb_workload_analysismagellan_mongodb_workload_analysis
magellan_mongodb_workload_analysisPraveen Narayanan
 
Capacity Planning for Linux Systems
Capacity Planning for Linux SystemsCapacity Planning for Linux Systems
Capacity Planning for Linux Systems
Rodrigo Campos
 
Performance Oriented Design
Performance Oriented DesignPerformance Oriented Design
Performance Oriented Design
Rodrigo Campos
 
Noha danms13 talk_final
Noha danms13 talk_finalNoha danms13 talk_final
Noha danms13 talk_finalNoha Elprince
 
Efficient use of NodeJS
Efficient use of NodeJSEfficient use of NodeJS
Efficient use of NodeJSYura Bogdanov
 
Data Stream Management
Data Stream ManagementData Stream Management
Data Stream Management
k_tauhid
 
Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Cassandra Summit 2014: Active-Active Cassandra Behind the ScenesCassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
DataStax Academy
 
Resilience at exascale
Resilience at exascaleResilience at exascale
Resilience at exascaleMarc Snir
 
Resilience at Extreme Scale
Resilience at Extreme ScaleResilience at Extreme Scale
Resilience at Extreme Scale
Marc Snir
 
Betting On Data Grids
Betting On Data GridsBetting On Data Grids
Betting On Data Grids
gojkoadzic
 
Is ScalaC Getting Faster, or Am I just Imagining It
Is ScalaC Getting Faster, or Am I just Imagining ItIs ScalaC Getting Faster, or Am I just Imagining It
Is ScalaC Getting Faster, or Am I just Imagining It
Rory Graves
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
Stéphane Maldini
 
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
Nick Galbreath
 
Mining big data streams with APACHE SAMOA by Albert Bifet
Mining big data streams with APACHE SAMOA by Albert BifetMining big data streams with APACHE SAMOA by Albert Bifet
Mining big data streams with APACHE SAMOA by Albert Bifet
J On The Beach
 
Self-Adaptation of Online Recommender Systems via Feed-Forward Controllers
Self-Adaptation of Online Recommender Systems via Feed-Forward ControllersSelf-Adaptation of Online Recommender Systems via Feed-Forward Controllers
Self-Adaptation of Online Recommender Systems via Feed-Forward Controllers
FET AWARE project - Self Awareness in Autonomic Systems
 

Similar to Evaluating Data Freshness in Large Scale Replicated Databases (20)

Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
 
Measuring Docker Performance: what a mess!!!
Measuring Docker Performance: what a mess!!!Measuring Docker Performance: what a mess!!!
Measuring Docker Performance: what a mess!!!
 
Usenix LISA 2012 - Choosing a Proxy
Usenix LISA 2012 - Choosing a ProxyUsenix LISA 2012 - Choosing a Proxy
Usenix LISA 2012 - Choosing a Proxy
 
Capacity Planning for fun & profit
Capacity Planning for fun & profitCapacity Planning for fun & profit
Capacity Planning for fun & profit
 
magellan_mongodb_workload_analysis
magellan_mongodb_workload_analysismagellan_mongodb_workload_analysis
magellan_mongodb_workload_analysis
 
Capacity Planning for Linux Systems
Capacity Planning for Linux SystemsCapacity Planning for Linux Systems
Capacity Planning for Linux Systems
 
Performance Oriented Design
Performance Oriented DesignPerformance Oriented Design
Performance Oriented Design
 
Noha danms13 talk_final
Noha danms13 talk_finalNoha danms13 talk_final
Noha danms13 talk_final
 
Efficient use of NodeJS
Efficient use of NodeJSEfficient use of NodeJS
Efficient use of NodeJS
 
Data Stream Management
Data Stream ManagementData Stream Management
Data Stream Management
 
Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Cassandra Summit 2014: Active-Active Cassandra Behind the ScenesCassandra Summit 2014: Active-Active Cassandra Behind the Scenes
Cassandra Summit 2014: Active-Active Cassandra Behind the Scenes
 
Resilience at exascale
Resilience at exascaleResilience at exascale
Resilience at exascale
 
Resilience at Extreme Scale
Resilience at Extreme ScaleResilience at Extreme Scale
Resilience at Extreme Scale
 
Raptor codes
Raptor codesRaptor codes
Raptor codes
 
Betting On Data Grids
Betting On Data GridsBetting On Data Grids
Betting On Data Grids
 
Is ScalaC Getting Faster, or Am I just Imagining It
Is ScalaC Getting Faster, or Am I just Imagining ItIs ScalaC Getting Faster, or Am I just Imagining It
Is ScalaC Getting Faster, or Am I just Imagining It
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
 
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
Rate Limiting at Scale, from SANS AppSec Las Vegas 2012
 
Mining big data streams with APACHE SAMOA by Albert Bifet
Mining big data streams with APACHE SAMOA by Albert BifetMining big data streams with APACHE SAMOA by Albert Bifet
Mining big data streams with APACHE SAMOA by Albert Bifet
 
Self-Adaptation of Online Recommender Systems via Feed-Forward Controllers
Self-Adaptation of Online Recommender Systems via Feed-Forward ControllersSelf-Adaptation of Online Recommender Systems via Feed-Forward Controllers
Self-Adaptation of Online Recommender Systems via Feed-Forward Controllers
 

More from Miguel Araújo

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
 
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
Miguel Araújo
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
Miguel Araújo
 
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdfDeep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Miguel Araújo
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
Miguel Araújo
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Miguel Araújo
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
Miguel Araújo
 
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
Miguel Araújo
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - TutorialMySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - Tutorial
Miguel Araújo
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
Miguel Araújo
 
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
Miguel Araújo
 
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
 
MySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB ClustersMySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB Clusters
Miguel Araújo
 
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
Miguel Araújo
 
MySQL Shell - The DevOps Tool for MySQL
MySQL Shell - The DevOps Tool for MySQLMySQL Shell - The DevOps Tool for MySQL
MySQL Shell - The DevOps Tool for MySQL
Miguel Araújo
 

More from Miguel Araújo (15)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
 
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdfDeep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - TutorialMySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - Tutorial
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
 
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
 
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQLMySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
 
MySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB ClustersMySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB Clusters
 
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
 
MySQL Shell - The DevOps Tool for MySQL
MySQL Shell - The DevOps Tool for MySQLMySQL Shell - The DevOps Tool for MySQL
MySQL Shell - The DevOps Tool for MySQL
 

Evaluating Data Freshness in Large Scale Replicated Databases

  • 1. Evaluating Data Freshness in Large Scale Replicated Databases Miguel Araújo and José Pereira Partially funded by project ReD - Resilient Database Clusters (PDTC / EIA-EIA / 109044 / 2008)
  • 4. Introduction • Why replicate? • Replicating data improves fault-tolerance • Allows the construction of large scale systems • Improves performance
  • 5. Introduction • Why replicate? • Replicating data improves fault-tolerance • Allows the construction of large scale systems • Improves performance • There are different replication protocols: • Lazy schemes use separate transactions for execution and propagation • Eager schemes distribute updates to replicas in the context of the original updating transaction
  • 6. Introduction • Why replicate? • Replicating data improves fault-tolerance • Allows the construction of large scale systems • Improves performance • There are different replication protocols: • Lazy schemes use separate transactions for execution and propagation • Eager schemes distribute updates to replicas in the context of the original updating transaction • Most database management systems implement lazy master-slave replication The application has to deal with stale data in order to avoid data inconsistency among replicas
  • 7. Background Replication Mechanism • Replication mechanism of MySQL: 1. The master records changes to its data in its binary log (these records are called binary log events) 2. The slave copies the master’s binary log events to its own log (relay log) 3. The slave replays the events in the relay log, applying the changes to its own data
  • 8. Background Replication Topologies • MySQL in particular allows almost any configuration of master and slave, as long as each server has at most one master
  • 9. Background Replication Topologies • MySQL in particular allows almost any configuration of master and slave, as long as each server has at most one master Master and multiple slaves
  • 10. Background Replication Topologies • MySQL in particular allows almost any configuration of master and slave, as long as each server has at most one master Master and multiple slaves Chain
  • 13. Background Replication Topologies The ring topology is the only one that allows update- everywhere replication (if the application does not found any conflicts) Ring
  • 14. Background Data Freshness • But... These techniques do not provide data freshness guarantees • So, asynchronous replication leads to periods of time that copies of the same data diverge • MySQL replication is commonly known as being very fast • There have not been systematic efforts to characterize data freshness in MySQL
  • 15. Goal
  • 16. Goal Assessing the impact of replication topology in MySQL, towards maximizing scalability and data freshness
  • 17. Agenda Approach Experiments - Workload - Setting - Results Conclusions
  • 18. Measuring Propagation Delay Approach • Our approach is based on using a centralized probe • It periodically query each of the replicas, thus discovering what has been the last update applied • By comparing such positions, it should be possible to discover the propagation delay There are however several challenges that have to be tackled to obtain correct results:
  • 20. Measuring Propagation Delay Approach • Measuring updates
  • 21. Measuring Propagation Delay Approach • Measuring updates • Non-simultaneous probing Problem: cannot probe master and slave simultaneously, so readings are not comparable !"#$%& '(")% !*+,$*&
  • 22. Measuring Propagation Delay Approach • Measuring updates Solution: interpolate with a line the time-log position values of the master and then compare each replica • Non-simultaneous probing value point with it. At the end, calculate the average Problem: cannot probe master and slave simultaneously, so readings are not comparable ! " ."/)&"#0,0"1 ! !"#$%& " ! #$%&'( " ! " ! '(")% " !)*)%$#,(- ")*)#'$+( !*+,$*& 20%(
  • 24. Measuring Propagation Delay Approach • Eliminating quiet periods Problem: sampling twice without updates erroneously biases the estimate !"#$%& '(")% !*+,$*&
  • 25. Measuring Propagation Delay Approach • Eliminating quiet periods Solution: select periods where line segments from both replicas have a positive slope Problem: sampling twice without updates erroneously biases the estimate !"#$%& '(")% !*+,$*&
  • 26. Measuring Propagation Delay Approach • Eliminating quiet periods
  • 27. Measuring Propagation Delay Approach • Eliminating quiet periods • Dealing with variability
  • 28. Measuring Propagation Delay Approach • Eliminating quiet periods • Dealing with variability Solution: consider a sufficient amount of samples and assume that each probe happens after half of the observed round-trip
  • 29. Experiments Workload • We have chosen the workload model defined by TPC-C benchmark • TPC-C is composed mostly by update intensive transactions • The master server is almost entirely dedicated to update transactions even in a small scale experimental setting, mimicking what would happen in a very large scale MySQL setup • Each client is attached to a database server and produces a stream of transaction requests
  • 30. Experiments Setting • Two replication schemes were installed and configured. A five machine topology of master and multiple slaves, and a five machine topology in daisy chain • All machines are connected through a LAN, and are named PD01 to PD06. Being PD01 the master instance, PD04 the remote machine in which interrogation client executed, and the others the slave instances Machines: HP’s - lab SO OS: Linux Ubuntu Server 2.6.31-14 ✓ 20 clients CPU: 2 Intel(R) Core(TM)2 CPU 6400 - 2.13GHz ✓ 80 clients ✓ 40 clients MEM: 1 GB ✓ 100 clients DBMS: MySQL 5.1.39 ✓ 60 clients Scale Factor(warehouses): 2 Duration: 20 minutes
  • 31. Results • Results for the different number of TPC-C clients on the master and multiple slaves topology PD02 PD03 PD05 PD06 11000 9900 8800 7700 Delay Average (µs) 6600 5500 4400 3300 2200 1100 0 20 40 60 80 100 Clients
  • 32. Results • Results for the different number of TPC-C clients on the chain topology PD02 PD03 PD05 PD06 32000 28800 25600 22400 Delay Average (µs) 19200 16000 12800 9600 6400 3200 0 20 40 60 80 100 Clients
  • 34. Conclusions We were able to measure freshness accurately and with a realistic workload
  • 35. Conclusions We were able to measure freshness accurately and with a realistic workload Results show how much:
  • 36. Conclusions We were able to measure freshness accurately and with a realistic workload Results show how much: • Delay grows with workload • Delay grows with number of replicas attached • Delay grows with number of hops
  • 37. Conclusions We were able to measure freshness accurately and with a realistic workload Results show how much: • Delay grows with workload • Delay grows with number of replicas attached • Delay grows with number of hops The conclusion is that the scalability of MySQL using its replication mechanism is limited when data freshness is a concern
  • 38. Questions? Thank you