You are on page 1of 12

Replication

Replication refers to the process of creating and


maintaining multiple copies of data or services
across multiple nodes or servers within the
system.
The primary goal of replication is to improve the
availability, reliability, and performance of the
system.
The Need for Replication

 Ensuring system availability and reliability


 Reducing downtime and increasing fault tolerance
 Improving system performance and scalability
 Enhancing data consistency and integrity
Types of Replication

1. Active replication :involves maintaining multiple replicas of a service, with each replica actively
processing requests from clients. In active replication, all replicas receive the same requests in the same
order, and each replica produces the same output. Clients can choose to send their requests to any replica,
and the replicas use a consensus protocol to agree on the order of requests and ensure consistency among
themselves. This technique is also known as primary-backup replication, because one replica (the primary)
is designated as the leader and the others (the backups) follow its decisions.

2. Passive replication : involves maintaining multiple replicas of a service, with only one replica actively
processing requests from clients. The other replicas remain idle until the active replica fails, at which point
one of the passive replicas takes over and becomes the new active replica. The state of the active replica is
periodically checkpointed and sent to the passive replicas, so that they can take over without losing any
information.
Active Replication
Involves multiple replicas of a service or data, where each replica processes requests independently. Clients
send requests to all replicas, and once a majority of replicas have processed a request and returned the result,
the client considers the request complete.

This approach ensures high availability and fault tolerance, as well as load balancing, as requests are spread
across multiple replicas.

It requires a significant amount of network bandwidth and can suffer from inconsistency issues if replicas are
not synchronized properly.

Active replication is commonly used in systems that require high availability and low latency, such as online
transaction processing systems.
Advantages and Disadvantages
Advantages Disavantages

High Availability- Backup replicas can take over when High Overhead-It has high overhead because all
the primary replica fails. replicas must communicate with each other to
maintain consistency.

Fault Tolerance- Multiple replicas are executing and Complexity- Active replication is more complex than
communicating with each other to provide a consistent passive replication because it requires coordination
view of the system. among replicas

Consistency-All replicas execute updates in the same Scalability-Active replication is less scalable than
order. passive replication because all replicas must execute
updates.
Application
• In a banking environment, active replication can be used to replicate
the core banking system.
• The core banking system is the heart of any banking institution, and it
manages all the customer accounts, transactions, and balances. In an
active replication setup, multiple copies of the core banking system are
running simultaneously, and each copy can process customer
transactions independently.
• The results of each transaction are sent to a coordinator, which selects
the correct result and returns it to the customer.
• This setup ensures high availability of the core banking system, as any
failure in one copy can be automatically detected and corrected by
another copy.
Passive Replication
 A single primary replica is responsible for processing client requests
and updating the shared state of the system. However, multiple
backup replicas of the primary replica are maintained to provide fault
tolerance.
Clients send requests to the primary replica, which processes the
request and sends the result to all backup replicas. The backup
replicas maintain a copy of the primary replica's state and synchronize
with the primary replica periodically.
 If the primary replica fails, one of the backup replicas takes over as
the new primary replica, and clients send requests to the new primary
replica instead.
Advantages and Disadvantages
Advantages Disadvantages

Low Complexity: Passive replication is simpler to Inconsistency: Passive replication can result in
implement than active replication, as it does not require temporary inconsistencies in the system when a
complex coordination mechanisms replica fails and another replica takes over as the
active replica.

Low Overhead: Passive replication involves executing Reduced Fault Tolerance: Passive replication provides
requests on only one replica at a time, reducing the less fault tolerance than active replication since it
overhead of the system. relies on the failover mechanism to ensure continuity
of service.

Low Latency: Passive replication can provide lower latency Reduced Consistency: Passive replication can result in
than active replication, as there is no need for a temporary loss of consistency when a replica fails,
coordination among replicas and another replica takes over as the active replica.
Application
Web Applications:
• Web applications that need to handle a large number of requests and
provide high availability can benefit from passive replication.
• By replicating the web application across multiple nodes, passive
replication can ensure that the application remains available even if
one or more nodes fail.
Replication Simulation

You might also like