Consistency - Availibility - Partition Flashcards
(17 cards)
What is the difference between Performance and Scalability ?
A service is scalable if it results in increased performance in a manner proportional to resources added.
Generally, increasing performance means serving more units of work, but it can also be to handle larger units of work, such as when datasets grow.
Another way to look at performance vs scalability:
If you have a performance problem, your system is slow for a single user.
If you have a scalability problem, your system is fast for a single user but slow under heavy load.
What is the difference between Latency and Throughput ?
Latency and throughput are two important measures of a system’s performance.
Latency refers to the amount of time it takes for a system to respond to a request.
Throughput refers to the number of requests that a system can handle at the same time.
Generally, you should aim for maximal throughput with acceptable latency.
What is the difference between Availability and Consistency ?
Availability refers to the ability of a system to provide its services to clients even in the presence of failures. This is often measured in terms of the percentage of time that the system is up and running, also known as its uptime.
Consistency, on the other hand, refers to the property that all clients see the same data at the same time. This is important for maintaining the integrity of the data stored in the system.
In distributed systems, it is often a trade-off between availability and consistency. Systems that prioritize high availability may sacrifice consistency, while systems that prioritize consistency may sacrifice availability. Different distributed systems use different approaches to balance the trade-off between availability and consistency, such as using replication or consensus algorithms.
What is the CAP Theorem ?
According to CAP theorem, in a distributed system, you can only support two of the following guarantees:
- Consistency - Every read receives the most recent write or an error
- Availability - Every request receives a response, without guarantee that it contains the most recent version of the information
-
Partition Tolerance - The system continues to operate despite arbitrary partitioning due to network failures
Networks aren’t reliable, so you’ll need to support partition tolerance. You’ll need to make a software tradeoff between consistency and availability.
What are the pro and con of leaning toward CP (consistency and partition tolerance) ?
- Data will always be accurrate and conform to last write.
- But waiting for a response from the partitioned node might result in a timeout error.
CP is a good choice if your business needs require atomic reads and writes.
What are the pro and con of leaning toward AP (availability and partition tolerance) ?
- Data will always be provided as fast as possible.
- Responses return the most readily available version of the data available on any node, which might not be the latest.
- Writes might take some time to propagate when the partition is resolved.
AP is a good choice if the business needs to allow for eventual consistency or when the system needs to continue working despite external errors.
What are the three main types of consistency patterns ?
Consistency patterns refer to the ways in which data is stored and managed in a distributed system, and how that data is made available to users and applications.
There are three main types of consistency patterns:
- Strong consistency
- Weak consistency
- Eventual Consistency
Each of these patterns has its own advantages and disadvantages, and the choice of which pattern to use will depend on the specific requirements of the application or system.
What is Weak Consistency ?
After an update is made to the data, it is not guaranteed that any subsequent read operation will immediately reflect the changes made. The read may or may not see the recent write.
What is Eventual Consistency ?
Eventual consistency is a form of Weak Consistency. After an update is made to the data, it will be eventually visible to any subsequent read operations. The data is replicated in an asynchronous manner, ensuring that all copies of the data are eventually updated.
What is Strong Consistency ?
After an update is made to the data, it will be immediately visible to any subsequent read operations. The data is replicated in a synchronous manner, ensuring that all copies of the data are updated at the same time.
How is Availability measured ?
Availability is often quantified by uptime (or downtime) as a percentage of time the service is available.
Availability is generally measured in number of 9s. For instance, a service with 99.99% availability is described as having four 9s.
What can affect Availability ?
Availability is affected by system errors, infrastructure problems, malicious attacks, and system load.
What is SLA ?
Cloud applications typically provide users with a service level agreement (SLA), which means that applications must be designed and implemented to maximize availability.
What are the downtime per year/month/week/day of a 99.9% Availability ?
Duration | Acceptable downtime ------------- | ------------- Downtime per year | 8h 41min 38s Downtime per month | 43m 28s Downtime per week | 10m 4.8s Downtime per day | 1m 26s
What are the downtime per year/month/week/day of a 99.99% Availability ?
Duration | Acceptable downtime ------------- | ------------- Downtime per year | 52min 9.8s Downtime per month | 4m 21s Downtime per week | 1m 0.5s Downtime per day | 8.6s
What is Availability in sequence ? How can it be calculed ?
Overall availability decreases when two components with availability < 100% are in sequence:
Availability (Total) = Availability (Foo) * Availability (Bar) If both Foo and Bar each had 99.9% availability, their total availability in sequence would be 99.8%.
What is Availability in parallel ? How can it be calculed ?
Overall availability increases when two components with availability < 100% are in parallel:
Availability (Total) = 1 - (1 - Availability (Foo)) * (1 - Availability (Bar))
If both Foo and Bar each had 99.9% availability, their total availability in parallel would be 99.9999%.