MySQL replication Tungsten vs. Galera
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
MySQL replication is a vital component in scaling and ensuring high availability for databases. Two prominent replication technologies that offer high availability and fault tolerance are Tungsten Replicator and Galera Cluster. Both methods have distinct characteristics, strengths, and weaknesses that make them suitable for different scenarios.
Tungsten Replicator
Tungsten Replicator is a powerful tool for MySQL replication developed by Continuent. It provides robust data replication with features that cater to complex database environments. Here are some of its key characteristics:
Key Features
- Master-Slave Replication: Tungsten supports asynchronous master-slave replication, allowing for flexible replication architectures.
- Event-Based: Utilizes a complex pipeline of stages to process events through Extractor, Applier, and other processes, resulting in a highly customizable replication.
- Advanced Filtering: Supports advanced transformation and filtering of data which can be essential for migrating data or selective replication tasks.
- Cross-Site Replication: Enables replication across different sites and can handle geographically distributed nodes, making it well-suited for global deployments.
Technical Explanation & Examples
Pipeline Approach
Tungsten uses a pipeline-based approach. An event goes through several steps as it moves from the source to the target database. For example, a transaction binlog event is extracted, transformed, and then applied to the target database.
Scenario: Filtering Data
If you want to exclude certain tables from being replicated:
Galera Cluster
Galera Cluster is a synchronous multi-master replication solution for MySQL and MariaDB. It provides high-availability and enhanced write scalability by allowing writes to be performed on any node.
Key Features
- Synchronous Replication: Ensures that transactions are committed on all nodes, guaranteeing consistency across the cluster.
- True Multi-Master: Any node can accept read and write transactions, offering maximum flexibility and eliminating the single point of failure.
- Automatic Node Provisioning: New nodes can join the cluster and be automatically provisioned with the current state of the database.
- High Performance: Galera uses an optimistic "certification-based replication" approach, which minimizes the delay of replication.
Technical Explanation & Examples
Write-Set Replication
Galera uses a certification-based approach where transactions are grouped as "write-sets". These write-sets are broadcast to all nodes for replication.
If this transaction commits successfully on one node, it is certified and applied across all nodes.
Node Bootstrap
When initializing a new cluster:
This command boots up the first node of the cluster, and additional nodes can join using standard SST (State Snapshot Transfer) protocols.
Comparison Table
Let's compare the two replication technologies with a summary table:
| Feature/Aspect | Tungsten Replicator | Galera Cluster |
| Replication Type | Asynchronous | Synchronous |
| Complexity | Higher, due to event-based model | Simpler with built-in consensus mechanisms |
| Write Method | Single master (master-slave) | Multi-master (any node can write) |
| Consistency Model | Eventually consistent | Strong consistency |
| Conflict Handling | No automatic conflict handling | Automatic with certification conflicts |
| New Node Handling | Requires explicit setup and configuration | Automatic provisioning through SST |
| Geographic Distribution | Best suited for diverse distributions | Performance degrades over large distances |
| Strong Points | Flexibility, Filtering, Transformations | Consistency, High Availability |
Subtopics for Enhanced Understanding
Use Cases
- Tungsten Replicator: Suitable for organizations looking for complex replication environments where filtering and partial replication are required. Its cross-site capabilities make it ideal for globally distributed databases.
- Galera Cluster: Best suited for scenarios demanding immediate consistency and high availability, such as online transaction processing systems and real-time applications that require high write throughput and are located within a single geographical area.
Installation and Configuration
Both Tungsten Replicator and Galera Cluster require comprehensive installation steps. Tungsten's configuration might seem intricate due to its pipeline flexibility, while Galera offers a more streamlined configuration suitable for multi-master configurations.
Performance Considerations
Galera's synchronous nature might introduce latency in geographically distributed deployments, whereas Tungsten’s approach can better manage such scenarios but at the expense of immediate consistency.
In conclusion, selecting between Tungsten Replicator and Galera Cluster depends heavily on the specific needs of an organization, including consistency requirements, scale, distribution of nodes, and tolerance to conflicts. Understanding the strengths and limitations of each can guide database administrators in making the most suitable choice for their infrastructure.
Related reading
- MySQL replication vs other techniques
- MySQL sharding and partition in distributed system
- Mysql Slave not updating
- mysql slave parallel workers from lower version master
- MySQL Results as comma separated list
- MySQL root access from all hosts
- Need a distributed key-value lookup system
- Need a distributed key-value lookup system in PHP

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.