Types of Data Replication: A Comprehensive Guide 101

By: Published: January 27, 2023

Types of data replication FI

Data replication is the process of duplicating data across multiple locations. This can include moving data between cloud-based servers, on-premise hosts, and more. Data replication can occur in batches according to a set schedule, on-demand, or in real-time as changes are made to the primary repository. 

Generally, data replication is used by businesses to avert the loss of data caused by server failures, network problems, or other interferences. This ensures that data is available and accessible for business use 24/7. Different business has varied organizational needs. As a result, there is no one-fits-all data replication technology. In this article, we shall learn about the different types of data replication available. To understand that, let us start with what are the key components of data replication.

Table of Contents

What is Data Replication?

Data replication is the process of copying data from one location to another, typically in order to maintain consistency and availability of the data in case of failure or network issues. This can be done between different servers, storage devices, or even between different geographic locations. The copies of the data can be used for backup, disaster recovery, or to support distributed systems.

Key Components in Data Replication

Every data replication process involves three main components or agents: publisher, subscriber, and distributor.

In data replication, a publisher refers to a source or origin of data that is being replicated, i.e., primary repository or server. Here, the data is initially produced or modified. The recipient or destination of the replicated data is a subscriber, i.e., a secondary server. This is the location to which the data is being copied. 

A distributor serves as an intermediary between the publisher and subscriber and organizes and supervises the replication process. It takes modifications made by the publisher and then duplicates them for the subscribers. In a nutshell, the publisher publishes the data, the distributor oversees the replication process, and the subscriber receives the replicated data.

Types of Data Replication

Three traditional data replication methods cater to different data requirements, organizational infrastructure needs, and business goals:

Snapshot Replication

It is a method of replicating data exactly as it appears at a specific time. Unlike other methods, snapshot replication does not consider changes made to the data between replication cycles. This approach is suitable for scenarios where the initial synchronization between the publisher and subscriber requires minimal data changes.

For a successful snapshot replication, you will need two agents. The first is the Snapshot Agent, which captures and keeps track of all synchronizations with the distribution database. It also collects and stores the files containing the database schema and objects. The second agent is the Distribution Agent, which delivers files to the target databases.

Merge Replication

Merge replication consolidates data from multiple sources into a single database. This enables multiple users to change the data and apply all updates to the new replica. This is initiated with a snapshot of the data, which is then distributed to its replicas and ensures data synchronization throughout the entire system. Merge replication enables users to make changes offline before synchronizing with the server, providing increased flexibility.

A key benefit of merge replication is it allows for replicating a data object’s latest value, regardless of how many times it has changed. This method could even be preferred if updates to the replicas must be reflected in the primary source and other replicas. 

Merge replication process begins with use of the Snapshot Agent like in snapshot replication. The agent takes a snapshot of the data, which is distributed to its replicas, and ensures data synchronization in the system.  Next, a Merge Agent overlooks replicating any incremental modifications made to the primary database and applies the snapshot files in the other databases. The Merge Agent also identifies and resolves any data conflicts that can emerge throughout the replication process. This ensures that all replicas are kept up-to-date and consistent with the primary database.

Transaction Replication

It is a method of replicating databases by copying them entirely from the publisher to the subscribers. Any changes made to the publisher are mirrored to the subscribers instantly and in the same order. Here, it is critical to have a snapshot of the publisher to ensure the subscribers have the same data and database structure as the publisher. This makes it easier to trace changes, maintain consistent updates and retrieve any lost data.

Transaction replication is excellent for businesses that can’t afford downtime of more than a few minutes. This approach assures that incremental updates are copied to subscribers in real time and is suitable for databases that change regularly. Transactional replication might also be helpful if you require the latest data for analytics. Replicating real-time changes guarantees that replicas’ data is always up to date, which is vital for analytics and other organizational activities.

You require the Snapshot Agent, Log Reader Agent, and Distribution Agent to accomplish transactional replication.

The snapshot agent functions in a manner similar to that of the snapshot agent in snapshot replication. The Log Reader Agent monitors the transaction logs of the publisher and replicates the transactions to the distribution database. The Distribution Agent subsequently transfers the snapshot files and transaction logs from the distribution database to the subscribers.

Types of Data Replication Schemes

Replication schemes are the structures followed in executing replication. Organizations can select between three basic replication schemes:

Full Replication

Full replication means replicating the entire database to all the nodes in a distributed system.  Full replication improves performance and data access globally by ensuring multiple copies of data. In other words, it provides the highest data availability and redundancy level. 

For organizations with a global presence, full replication allows users in different regions to access the same data at comparable speeds. 

However, if a server is disrupted in a specific region, such as Asia, users can retrieve the data from backup servers in other regions, such as Europe or North America.

Partial Replication

Partial replication replicates a database by dividing the data into sections and storing each section in different locations. This is executed in accordance with the importance of the data for a particular location and the specifications outlined in the replication schema. The number of copies for each segment of the database can range from one to the total number of nodes in the distributed system. Partial replication is beneficial for companies with a mobile workforce, such as insurance agents, PR planners, and salespeople. 

No Replication

No replication means data is stored in one location only. In other words, only one copy of the data is on each node in a distributed system. This is the simplest way to keep the data in sync and is also the fastest to implement. However, no replication tends to lower data performance and availability.

Types of Data Replication Strategies

Although companies may employ a variety of strategies for data replication, the following replication strategies are the most popular:

Full Table Replication

Full table replication is a technique where all new and existing records are replicated from the source to the destination. This method allows the recovery of permanently deleted data and databases that do not have replication keys. It is suggested to use full table replication when records are frequently deleted or when alternative strategies are infeasible. Also, this approach is suitable for replicating small amounts of data or when initially replicating data. 

However, as the volume of data increases, particularly with a high replication frequency, the full table replication technique can cause performance issues. Consequently, this technique demands more processing power and network resources, resulting in higher costs.

One can implement full table replication either using:

  • Snapshot Replication

Snapshot replication generates a replica of your database by taking a “snapshot” of your tables, data, relationships, etc., at a particular point in time and then replicating it on the other database. It does not monitor any updates.

  • Transaction Replication

Transactional replication monitors the updates as they occur on the master database and then performs sync to make all these changes in the replicas.

Read More: Full Table Data Replication

Incremental Replication 

In the incremental data replication strategy, only records are replicated where the system notices any changes since the last replication schedule. Thus, it will fully copy all the data that has been updated or altered since the last replication. As only new and modified data is being focused upon, this process is faster and less resource-intensive. This method is more efficient than full table replication as it involves copying fewer rows of data during each update. It is more complex than full replication, requiring a robust monitoring solution for effective implementation. Incremental replication is suitable for databases primarily focusing on recent changes instead of historical values.

One can perform incremental replication using either of the two strategies:

  • Key-based Incremental Replication

Key-based incremental replication involves updating only the data that has been modified since the previous update based on unique keys. However, key-based replication can’t replicate permanently deleted data since the key value is wiped when the record is deleted.

  • Log-based Incremental Replication

Log-based incremental replication is a specific type of replication that applies only to databases. This method is enabled by the use of log-based Change Data Capture (CDC) and employs the binary log files of a database to identify changes.

Read More: Incremental Data Replication

Types of Data Replication Based on Location

The location of the replication is another way to classify data replication systems. In general, replication can occur in three places: in the storage array, on the host (server), or across the network. There is a fourth type of replication which is used for virtual machines.

  • Host-based Replication: The replication process takes place on the host server. It may affect the server’s performance, but it’s cost-effective.
  • Array-based Replication: This is done on the storage array. It’s less prone to disruptions but limited to a single vendor and homogeneous storage environments.
  • Network-based Replication: The replication process takes place over the network. It is independent of the host and storage array but may have higher latency.
  • Hypervisor-based Replication: Hypervisor establishes a virtualization layer separating physical hardware components from virtual machines and operating systems. Hypervisor-based replication is a system that automatically creates and maintains clones of virtual systems. This replication method protects virtual machines at the file level rather than at the LUN or storage volume level. By doing so, it avoids any added management and cost challenges associated with array-based replication.

Synchronous vs. Asynchronous Data Replication

Process

The critical contrast between synchronous and asynchronous replication is the manner in which data is written to the replica. Data is simultaneously written to both the primary and replica in synchronous replication. In contrast, asynchronous replication only replicates data to the replica after it has already been written to the primary. The asynchronous replication method uses snapshots to copy data that has changed and sends it to the replica at a set schedule. While the replication process may occur in near-real-time, it is common for replication to occur on a scheduled basis. The schedule is determined by the number and frequency of snapshots the storage and application can handle.

Bandwidth Requirements

Synchronous data replication needs more bandwidth because it uses a special technique called two-phase commit to ensure accurate data. Synchronous replication ensures that all parts of the system agree to make the changes before they happen. This results in a larger bandwidth since the system components required for replication must constantly be active and ready.  This implies that to run synchronous replication, businesses need to spend more money on IT infrastructure. On the other hand, asynchronous replication costs less to install in an IT infrastructure since it uses less bandwidth and may not need to occur in real time. 

Use-case

 Synchronous replication is commonly used for high-end transactional applications that require immediate failover when the primary fails. Meanwhile, asynchronous replication is intended to operate over greater distances and is a superior choice for disaster recovery. However, it poses the risk of data loss during a system outage as the data at the target device may not be current with the source data. 

Synchronous replication is optimal when excellent availability and consistency between primary and secondary copies are paramount. Conversely, asynchronous replication is a viable alternative when the organization can tolerate minor system and network failures.

Asynchronous replication also provides different ways to replicate data:

  • Primary-target replication: In this model, all changes to the database are made at the primary database and then replicated to the target databases. Changes made to the target databases are not mirrored back to the primary. This approach is helpful when the primary database is regarded as the main data source and where all changes must originate.
  • Update-anywhere replication: In this model, all databases can both read and write data. Any updates made to any database will be applied to all the other databases. This approach is helpful for updating data from numerous places without first ensuring that the modifications are made to a central location.

Conclusion

Data replication offers numerous benefits, like data availability, for organizations by enabling the replication of data to multiple instances. Considering the available types of data replication methods, choosing the best solution for a company will rely on several variables. It could be an organization’s specific business requirements, the amount of data that needs to be replicated, the recovery time objectives, and the budget allocated for data replication. To choose the desired replication, organizations must also consider the importance of the data, ease of management, and the desired level of data consistency. 

Getting data from many sources into destinations can be a time-consuming and resource-intensive task. Instead of spending months developing and maintaining such data integrations, you can enjoy a smooth ride with Hevo Data’s 150+ plug-and-play integrations (including 40+ free sources).

Visit our Website to Explore Hevo Data

Saving countless hours of manual data cleaning & standardizing, Hevo Data’s pre-load data transformations get it done in minutes via a simple drag n drop interface or your custom python scripts. No need to go to your data warehouse for post-load transformations. You can run complex SQL transformations from the comfort of Hevo’s interface and get your data in the final analysis-ready form. 

Want to take Hevo Data for a ride? Sign Up for a 14-day free trial and simplify your data integration process. Check out the pricing details to understand which plan fulfills all your business needs.

Preetipadma Khandavilli
Freelance Technical Content Writer, Hevo Data

Preetipadma is passionate about freelance writing within the data industry, expertly delivering informative and engaging content on data science by incorporating her problem-solving skills.

No-Code Data Pipeline for Your Data Warehouse