1.3 Availability vs consistency Flashcards
What are the three guarantees in the CAP theorem?
Consistency, Availability, Partition Tolerance
These guarantees define the limits of what can be achieved in distributed systems.
What does consistency mean in the context of the CAP theorem?
Every read receives the most recent write or an error.
Consistency ensures that all clients see the same data at the same time.
Define availability in the CAP theorem.
Every request receives a response, without guarantee that it contains the most recent version of the information.
Availability focuses on ensuring responses are provided even if they are not the latest data.
What is partition tolerance?
The system continues to operate despite arbitrary partitioning due to network failures.
This is crucial for systems that cannot afford to go offline during network issues.
What is CP in distributed systems?
Consistency and Partition Tolerance.
In CP systems, availability may be compromised to ensure data consistency.
What is AP in distributed systems?
Availability and Partition Tolerance.
In AP systems, consistency may be sacrificed to ensure that the system remains operational.
What is weak consistency?
After a write, reads may or may not see it. A best effort approach is taken.
Common in systems like memcached and suitable for real-time applications.
Define eventual consistency.
After a write, reads will eventually see it, typically within milliseconds.
This approach is often used in systems like DNS and email.
What is strong consistency?
After a write, reads will see it. Data is replicated synchronously.
Strong consistency is ideal for systems requiring transactions.
What is active-passive failover?
Heartbeats are sent between the active and passive server. If interrupted, the passive server takes over.
The length of downtime depends on the state of the passive server.
What is active-active failover?
Both servers manage traffic, spreading the load between them.
Requires DNS or application logic to know about both servers.
What are the disadvantages of failover?
Adds more hardware and complexity, potential data loss if the active system fails before replication.
These factors can complicate system design.
How is availability quantified?
Availability is measured in uptime as a percentage, often described in terms of ‘nines’.
For example, 99.99% availability is referred to as four nines.
What is the acceptable downtime for 99.9% availability?
8h 45min 57s per year.
This level of availability is often referred to as three nines.
What happens to overall availability when components are in sequence?
Overall availability decreases.
The formula is Availability (Total) = Availability (Foo) * Availability (Bar).
What happens to overall availability when components are in parallel?
Overall availability increases.
The formula is Availability (Total) = 1 - (1 - Availability (Foo)) * (1 - Availability (Bar)).
What does the CAP theorem state about distributed systems?
You can only achieve two of the three guarantees: Consistency, Availability, and Partition Tolerance.
One must be sacrificed when designing distributed systems.
What is the main flaw in the service model of ‘Remembrance Inc’?
The system is not consistent; updates may not be synchronized between the two operators.
This leads to potential misinformation for customers.
What solution was proposed to fix the consistency problem in ‘Remembrance Inc’?
Both operators must inform each other of updates before completing calls.
This ensures that both have the latest information.
What issue arises when one operator of ‘Remembrance Inc’ does not report to work?
Availability problem; updates cannot be completed if one person is absent.
This can lead to customer dissatisfaction.
What is the proposed solution for maintaining both consistency and availability?
If one operator is unavailable, the other sends an email to update them.
This allows for updates while maintaining service availability.
What is the final flaw identified in the system of ‘Remembrance Inc’?
The system is not partition tolerant; if communication fails between operators, they cannot update each other.
This compromises availability during conflicts.
What is eventual consistency with a run-around clerk?
A clerk updates notebooks in the background, allowing updates to proceed without blocking.
This may lead to temporary inconsistencies but improves system performance.
What is the significance of the CAP theorem in distributed system design?
It helps in understanding trade-offs between consistency, availability, and partition tolerance.
This is crucial for making informed decisions in system architecture.