Skip to content

Availability Patterns

Definition

Availability patterns ensure that data is not lost upon hardware failures, software bugs or other disruptions. They provide redundancy, fault tolerance and disaster recovery capabilities.


Measuring Availability

Uptime Percentage: Measures the proportion of time a system is operational. Higher percentage means higher availability.

Mean Time Between Failures (MTBF): The average time between failures. Higher MTBF means higher availability.

Mean Time to Repair (MTTR): The average time to repair a failure. Lower MTTR means higher availability.

The Nines of Availability { width="450" }


Fail-Over Pattern

Handles compute-layer availability

There is a primary component handling the workload, and a secondary one waiting. The primary component is constantly monitored for signs of failure, and when it goes down, it is automatically replaced by the secondary component.

There are two ways to implement failover:

Active-Active

Both primary and secondary components are active, handling requests simultaneously. { width="450" }

Active-Passive:

The secondary component stays passive until the primary one fails. { width="450" }

Disadvantages of Fail-Over

Adds more hardware and additional complexity, and there is a potential loss of data if the newly written data can't be replicated to the passive.


Replication Pattern

Handles data-layer availability

Stores multiple copies of data across different locations. This redundancy ensures that even if one location experiences a failure, the data can still be accessed from another. There are two patterns.

Master-Master

Two or more nodes accept all writes and reads and will replicate changes to each other.

For example, take a global app where NA users will write and read to the NA node, and EU users will write and read to EU node.

The downside is that this adds a lot of complexity in regards to synchronization and resolving write conflicts.

Master-Slave

The master node handles all writes. One or more slave nodes get a copy of the data and handle reads.

For example, take a blog platform. When an author publishes a post, the write goes to the master node but the many people that are reading the posts get served by slave nodes. This takes pressure off of the master node.

However, the downside is that when the master node is down, the system can't handle writes.


Additional Remarks

Fail-Over and Replication patterns are usually used together, since one handles work and the other handles data.

References

Availability Patterns Redundancy