- Availability = system’s uptime in a given period of time
- Consistency ≠ Availability
- Fault tolerance = disaster recovery
- Strategies for improving availability
- Redundancy
- Load Balancing
- Data Replication
- Best Practices for High Availability
- Resources
Availability = system’s uptime in a given period of time
Amount of time a system is available to respond to requests.
High availability comes with load balancing and redundancy.
Availability refers to the ability of a system or service to be operational and accessible when needed. In other words, it is the measure of how often a system is available for use.
High availability refers to a system’s ability to avoid loss of service by minimizing downtime: Availability = Uptime / (Uptime + Downtime)
Metrics: Fine nines = 5 minutes a year. 99% is about 1.7 hours of downtime a week.
Example: Consider the following analogy to better understand the difference between fault tolerance and high availability. A twin-engine airplane is a fault tolerant system – if one engine fails, the other one kicks in, allowing the plane to continue flying. Conversely, a car with a spare tire is highly available. A flat tire will cause the car to stop, but downtime is minimal because the tire can be easily replaced.
AWS, GCP have SLA (service-level agreements)
Consistency ≠ Availability
Availability refers to the ability of a system or service to be operational and accessible when needed. In other words, it is the measure of how often a system is available for use.
Consistency refers to the ability of a system or service to provide the same results every time it is used, under the same conditions. In other words, it is the measure of how predictable and dependable a system is.
A highly available system is important for mission-critical applications that need to be accessible at all times, while a consistent system is important for applications that require predictable and reliable results.
For example, if a system is designed to prioritize consistency, it may become unavailable if one of its nodes fails, because the other nodes will not be able to process requests until the failed node is restored.
On the other hand, if a system is designed to prioritize availability, it may allow clients to continue reading and writing data even if some of the nodes in the system are unavailable, at the cost of potentially serving inconsistent data to clients.
Fault tolerance = disaster recovery
Fault tolerance refers to the ability of a system (computer, network, cloud cluster, etc.) to continue operating without interruption when one or more of its components fail.
Can be achieved by replacing automatically failed component:
- Hardware systems, creating the same server and backup data.
- Software systems, database can be replaced.
- Power sources.
Additionally, fault tolerance can be achieved through the use of redundancy. By creating multiple replicas of a system's components, such as servers and databases, a system can remain online even in the event of an unexpected failure. Similarly, having multiple power sources can help ensure that the system remains online in the event of a power outage.
Strategies for improving availability
Redundancy
Redundancy involves having backup components that can take over when primary components fail.
- Server Redundancy: Deploying multiple servers to handle requests, ensuring that if one server fails, others can continue to provide service.
- Database Redundancy: Creating a replica database that can take over if the primary database fails.
- Geographic Redundancy: Distributing resources across multiple geographic locations to mitigate the impact of regional failures.
Load Balancing
Load balancing distributes incoming network traffic across multiple servers to ensure no single server becomes a bottleneck, enhancing both performance and availability.
- Hardware Load Balancers: Physical devices that distribute traffic based on pre-configured rules.
- Software Load Balancers: Software solutions that manage traffic distribution, such as HAProxy, Nginx, or cloud-based solutions like AWS Elastic Load Balancer.
Data Replication
Data replication involves copying data from one location to another to ensure that data is available even if one location fails.
- Synchronous Replication: Data is replicated in real-time to ensure consistency across locations.
- Asynchronous Replication: Data is replicated with a delay, which can be more efficient but may result in slight data inconsistencies.
Best Practices for High Availability
- Design for Failure: Assume that any component of your system can fail at any time and design your system accordingly.
- Implement Health Checks: Regular health checks allow you to detect and respond to issues before they become critical failures.
- Use Multiple Availability Zones: Distribute your system across different data centers to prevent localized failures.
- Practice Chaos Engineering: Intentionally introduce failures to test system resilience.
- Implement Circuit Breakers: Prevent cascading failures by quickly cutting off problematic services.
- Use Caching Wisely: Caching can improve availability by reducing load on backend systems.
- Plan for Capacity: Ensure your system can handle both expected and unexpected load increases.