I am currently reading about Distributed Systems and I am facing two different terms which are described in a similar manner: Replication and Redundancy.
Can anyone explain each term in part?
I am currently reading about Distributed Systems and I am facing two different terms which are described in a similar manner: Replication and Redundancy.
Can anyone explain each term in part?
The two terms are at the first look pretty similar, but there is a significant difference between them.
The common part of the two terms is the fact that each of has something to do with more nodes/components/processes in a system.
"Redundancy is the duplication of nodes, in case of some of them are failing"
"Replication is the synchronization of state between redundant nodes."
Redundancy : Duplication of critical components (node, process) with the aim to achieve reliability. Redundancy helps avoid single-point failure. For instance, if we have two instances running and one of them fails then, then the system can switch over to another one.
Replication : Sharing information to ensure consistency between redundant resources.
Redundancy increases the reliability while Replication ensure Consistency.
Redundancy
is the term used to create a fault-tolerant system. Reduncancy is about keeping redundant capacity (backup) within a system to increase its reliability. A secondary capacity is kept ready as a backup, over and above the primary capacity.
To create a fault-tolerant system we follow those steps:
we provide redundancy
build a system in such a way that it can detect faults that are happening in an automated fashion
then recover from detected faults by using the reduncany that has been provided
There are 3 types of reduncancy:
1- Active Reduncany (Hot SPare)
like, backup engines in airplanes. Main and backup engines both are running simultaneously and in case of main engine failure, our system will switch to backup engine
2- Passive Reduncancy (Warm Spare):
it is like substitute players in a soccer game. It is not as quick as active redundancy
3- Cold Reduncany Spare(Backup):
backup tires in cars. there is a significant time delay.
Replication
is the term used in database design. It is the process of copying the data that reduces the latency.
In database design, the most common design is Primary/Secondary
design. Primary node is used for writing data, and Secondary node is used for reading data by the users. If Primary goes down, our system will assing the Secondary as Primary. As you see, we have redundancy here, in case of failure we are assigning another component to take over.
In sync replication
(atomic) after data is written to the Primary node by the client, the same data is passed to the Secondary node. If both transactions are successful then this transaction is committed, otherwise, everything will be rolled back to change the state will cause more transactions. this has higher latency but our Primary and Secondary databases will be in sync all the time. So when the Primary db goes down, secondary will switch to be Primary and this operation will be very quick. It is similar to airplane engines example. With sync replication, we have active-active redundancy
.
In async
replication once the data is written to the Primary, acknowledgment is sent to the client, then data is written to the Secondary node. This has lower latency because acknowledgment is sent to the user earlier. Let's say you had multiple write requests and you write them to the Primary, send the acknowledgment to the user and while those data is propagated to the Secondary node, if Primary goes down, Secondary will have some missing data and your system will promote the the Secondary as Primary so your new database will have some missing data. In async replication we have passive redundancy
The database is a stateful component, we are replicating the state here. If our system is more read-heavy system, then we might have to have more Secondary (or Read) nodes, so we provide redundancy and replication here.
When studying System Design, I got confused with these words, but later I found a simple explanation from here.
When you replicate something, you get a copy that's almost the same as the original, but not quite the same. There is usually some sort of difference between the original and the replicate. The original and its copy can have different sizes, for example. So, the idea behind replication is that the replicate is always slightly different from the original at least in terms of its identity.
As for the other term, the result of the process of duplication is a duplicate, which is an identical copy of the original in all of its aspects. If you make a duplicate of the keys to your house, the duplicate is going to be absolutely identical to the original keys in all respects. This means that a duplicate of something is as good as the original and can be used to replace it completely while this is usually not true for replicates.
© 2022 - 2025 — McMap. All rights reserved.