LibreCanon › Tech
AI Canon. Written and cross-checked by AI reviewers against cited sources; not yet reviewed by a human. Errors are possible. What this means

Why big cloud services go down: redundancy, failover, and cascading failures

Large cloud services keep several copies of their components and data and move work away from parts that break, yet they still have outages. This article explains the three ideas in its title and how each one can fail. Redundancy means keeping more than one copy of a component so that losing one copy does not stop the service. Failover means detecting that a component has failed and moving its work to a copy. A cascading failure, as this article uses the term, is a failure in one part of a system that leads to failures in parts that were working, often through the same mechanisms that were meant to provide protection.

The networking material comes from Peterson and Davie, Computer Networks: A Systems Approach [1–8]. The cloud design material comes from two Microsoft architecture guides for .NET developers, one on cloud-native applications for Azure [9–11] and one on microservices in containers [12–15]; their full titles are in the Sources. The corpus holds no vendor incident reports and no news articles, so this article describes outages in general terms and names no particular outage. Graphs, paths and trees are covered in Graph theory — networks, paths and coloring; independent events and how their probabilities combine are covered in Conditional probability and independence.

What fails

Peterson and Davie sort the failures a network designer has to plan for into three classes [1]. At the lowest level, bits in a message are corrupted in transit: sometimes a single bit, but more often a burst of several bits in a row. At the next level, whole packets are lost; the authors say a bit error is a less likely cause of a lost packet than a switch that has run out of space to hold packets and so has to discard one. At the third level a link or a node stops working: a cable is cut, or the computer at the end of it crashes. The causes they list for this third class are crashing software, power failures and “a reckless backhoe operator”, and they add that “Failures due to misconfiguration of a network device are also common” [1].

Microsoft’s cloud guide gives a similar list for a service that runs as many separate processes communicating over a network [9]: unexpected network latency; transient faults, meaning short-lived losses of network connectivity; a long synchronous operation that blocks the service; a crashed host process that is being restarted or moved elsewhere; a service too overloaded to answer for a short time; an orchestrator operation under way, for example a rolling upgrade or the move of a service to another node; and hardware failures.

The same guide arranges failures by how much they take down [11]. The smallest is a failed disk, which can affect one node of a cluster. A network switch that fails could affect a whole rack of servers. Loss of power, one of the less common failures, could disrupt an entire datacenter, and on rare occasions a whole region becomes unavailable. The rest of the article depends on this ordering: redundancy protects against a failure only if the copies are outside that failure’s scope.

Telling a failed part from a slow one

Before a system can move work away from a broken component, some other component has to decide that it is broken. Peterson and Davie point out that this is hard at two levels. For lost packets, one of the main difficulties is telling a packet that has been lost from one that has only been delayed. For nodes and links, a computer that has crashed can look like one that is only slow, and a cable that has been cut can look like one that is so unreliable that it corrupts many bits [1].

The routing protocols Peterson and Davie describe decide by timing. In distance-vector routing, a node either sends a control packet on a link at intervals and checks that an acknowledgment comes back, or treats the link as down when none of the routing updates it expects from the other end has arrived over the last few cycles of updates [3]. In link-state routing, each node can send “hello” packets to its neighbours at fixed intervals, and when no hello has arrived from a neighbour for long enough, the link to that neighbour is declared down [4].

Any rule of this kind has to fix a waiting time. With a short wait, real failures are found quickly, but some components that are only slow are declared dead; with a long wait, there are fewer such mistakes, but traffic goes on being sent to a dead component for longer. The sources describe the mechanism without giving a correct value, and the trade-off follows from the mechanism itself (our reasoning).

Redundancy

Copies in separate failure scopes

Microsoft’s guide sets out redundancy as a series of choices matched to the failure scopes above [11]. Against hardware failure, the guide recommends placing the parts of an application in different fault domains, for example virtual machines in different racks. Against datacenter failure, it recommends placing them in different datacenters that are isolated from each other’s faults, which Azure calls Availability Zones. Against the loss of a region, it recommends keeping a copy of the data and components in a second region, from which the application can be quickly recovered. Against heavy load, it recommends spreading requests over several instances behind a load balancer. Against data that is deleted or corrupted by accident, it recommends backups.

For services, the guide’s first recommendation is to run several instances of each one: the guide says that an application which relies on one instance of a service thereby “creates a single point of failure”, and that more instances improve both resilience and scalability [11]. A load balancer sends requests only to instances that are healthy and removes unhealthy ones from rotation automatically. Databases can be copied to other regions (geo-replication), so that if one region fails the application can switch to a copy elsewhere. At the level of names on the internet, a DNS traffic manager can send users to different regions according to their location, response time or the health of each region’s endpoints [11].

The internet’s own naming system is built the same way. Peterson and Davie note that each DNS zone is served by at least two name servers, so that the failure of one name server does not make the zone’s information unavailable [7].

The cost of redundancy

The guide says the right amount of redundancy depends on what the business needs, and that the choice affects both cost and complexity [11]. A deployment across several regions costs more and is harder to manage than a deployment in one region, and it needs operational procedures for failover and for failback. The guide’s conclusion is that some business situations might warrant the extra cost and complexity and others might not [11].

Redundancy can add a failure mode

Peterson and Davie give a networking example in which redundancy itself creates a new problem [2]. A switched Ethernet network can contain loops. One reason the authors give is that several administrators run the network, so it is possible that no one knows its whole layout, and someone can add a loop-closing switch without anyone noticing; the reason they call more likely is that the loops were built in on purpose, for redundancy, because without them a single failed link splits the network into two parts. But in a network with a loop, packets can potentially go round forever. In their example, a switch whose forwarding table has no entry yet for a destination forwards copies of the packet on all its other ports; two neighbouring switches do the same, the copies come back to the first switch, and it sends them out again, so the cycle repeats with nothing to stop it [2]. Switches avoid this by running a distributed spanning-tree algorithm, with which they agree on a subset of links that reaches every switch and contains no loop [2]. The authors note that the hard part is for all the switches to coordinate their decisions so that they reach a single view of that tree [2]. The redundant links are therefore safe only while every switch takes part correctly in that agreement (our reading).

The arithmetic of dependencies

Chains multiply

Microsoft’s microservices guide gives an example of how many dependencies add up. In its example, an application depends on 50 services, each available 99.99% of the time, and the guide says the result is “several hours of downtime each month” [12]. The figure can be checked. If the application needs all 50 at once and their failures are independent, the fraction of time all 50 are up is 0.9999 multiplied by itself 50 times, which is about 0.99501. The application is then down about 0.499% of the time, or about 3.6 hours in a 30-day month of 720 hours (our check). A single service at 99.99% would be down about 4.3 minutes in the same month (our check: 0.0001 × 720 hours = 0.072 hours).

The general point is that a request which must pass through many components succeeds only if every one of them works, so the chance of failure grows with the number of components. The same guide adds that this is made worse when services call one another through long chains of synchronous requests. Its example is a system with such a design that receives millions of calls a day; supposing a ratio of 1:4, every million calls received might lead to four million internal calls (our check, from its ratio) [12].

Copies only help if they fail separately

Redundancy works in the other direction. Suppose a component is available 99.9% of the time, and two copies of it are run so that the service works when either copy is up (an illustration, not a figure from the sources). If the two copies fail independently, both are down at the same moment with probability 0.001 × 0.001 = 0.000001, so the pair is available 99.9999% of the time. In a 30-day month, one copy alone would be down about 43 minutes; the pair would be down about 2.6 seconds (our check).

That calculation depends entirely on the word “independently”. If the two copies share a rack, both can stop when the network switch for that rack fails [11]. If they share a datacenter, both can stop when it loses power [11]. If they run the same faulty configuration or the same faulty software, both can stop on the same input (our reasoning). This is why failure scope matters for redundancy (our reading): two copies inside one scope are one copy as far as failures of that scope are concerned. How the probability of a joint event changes when events are not independent is the subject of Conditional probability and independence.

Failover

Routing around a failure

In a packet-switched network a failed node or link need not stop all traffic, because packets can sometimes be sent along another path [1]. The routers have to learn about the failure and agree on new paths. Peterson and Davie describe what happens in distance-vector routing, in which each node tells its neighbours how far it is from every destination [3]. Usually the nodes next to the failure send new distances and the network soon settles on new routes. In some orders of events it does not. In their example, the link from node A to node E fails. When the nodes next exchange distances, A announces that E is unreachable, while B and C report that they are two hops from E. Then, depending on exactly when each event happens, this might follow: B concludes it is three hops away, A that it is four, C that it is five, and so on. The nodes keep raising their estimates, and none of them learns that E cannot be reached, until the count reaches a number large enough to mean “unreachable” [3]. The authors call this the count-to-infinity problem.

The fixes have costs. Setting “infinity” to a small number, such as 16 for a network where no path is longer than 15 hops, limits how long the counting lasts, but it becomes a problem if the network grows until some nodes are more than 15 hops apart [3]. A rule called split horizon, under which a node does not advertise a route back to the neighbour it learned it from, only prevents loops between two nodes. Delaying new route advertisements for some time after a failure is reported avoids larger loops, but slows the whole process [3]. Link-state routing, in which every node floods a description of its own links to every other node, is in the authors’ words “proven to stabilize quickly”, but the flooding must be made reliable, and the authors note that “an early version of link-state routing used in the ARPANET caused that network to fail in 1981” [4]. In that case the failure of the whole network came from the routing protocol, the part of the network that responds to failures (our reading).

Failover between networks

Across the internet as a whole, routes between networks are chosen by the Border Gateway Protocol (BGP). Peterson and Davie describe BGP as able to handle very large networks, but as often not choosing the best route and as adapting slowly to outages [8]. They set this against a network of only a handful of sites, which can keep watch on the quality of each path it might use and so pick the best route at any moment [8]. The Resilient Overlay Network (RON) was an experimental network of this kind, built on top of the internet: each node measured latency, available bandwidth and loss to every other node, and could send traffic through another node when the direct path was bad [8]. Over 64 hours in 2001, a RON of 12 nodes detected 32 outages that each lasted more than 30 minutes, about one every two hours (our check), and recovered from all of them in under 20 seconds on average [8]. The authors add that the experiment suggested relaying through a single intermediate node is usually enough to get around a failure on the internet.

The method does not scale: because every node probes every other node, RON was limited to a few dozen nodes [8]. The authors leave open whether millions of such overlays, all probing the same paths, would load the network enough to cancel the benefit [8].

Failover in a cloud service

At the scale of a cloud application, Microsoft’s guide sets out the steps for designing redundancy, and failover is one question among them [11]. The designer finds the critical path that each request follows, checks whether every point on it has redundancy, and asks, for each subsystem, whether its failure would be met by failing over to another component. Load balancers take unhealthy instances out of rotation automatically. Regional failover needs data already copied to the other region and a way to send users there, such as DNS-level traffic management that can take each endpoint’s health into account [11].

How a failure cascades

The sources describe several ways in which one failure, or one overload, leads to others.

Retransmission and congestion collapse

The oldest example in the sources is in the internet itself. Peterson and Davie write that before TCP gained congestion control in the late 1980s, “the Internet was suffering from congestion collapse” [6]. Each host sent at the full rate its advertised window permitted. When a router became congested it dropped packets; the hosts timed out and sent those packets again, which added to the congestion [6]. The authors define the goal as stability: a stable network keeps delivering packets under heavy load, and a network without that property may reach a state in which throughput falls to zero, which they call congestion collapse [5]. TCP’s answer is for each sender to estimate how much the network can carry and to send a new packet only when an acknowledgment shows that an earlier one has left the network [6].

The pattern is the general one: sending again in response to loss increases the load that caused the loss.

Retries that add load

The same pattern occurs between services inside a cloud application. Microsoft’s guides recommend retrying requests that fail because of short faults, with an exponentially increasing wait between attempts [10, 13]. In the cloud guide’s example, a client is allowed up to four retries and the wait starts at two seconds and doubles each time [10]. The waits before the four retries are then 2, 4, 8 and 16 seconds, 30 seconds in all if every retry is needed (our check). In the guide’s run of the example, the first two calls fail and the third succeeds after waits of 2 and 4 seconds.

The guides also warn that retries can make an outage worse. When a service fails or slows down, many clients might retry their failed requests over and over, and there is a risk that the traffic sent to the failing service grows exponentially; the circuit-breaker page warns that careless retries could amount to a denial-of-service attack that the software makes on itself [14]. The cloud guide says that continual retries against a service that is not responding can lead to a “self-imposed denial of service scenario”, in which the continual calls use up memory, threads and database connections, so that other components with no link to the failing call, but which depend on the same resources, fail as well [10]. When many clients retry on the same schedule, their retries also arrive together; the microservices guide recommends a jitter strategy, with retry intervals that are smooth and evenly distributed, so that the peaks are spread out [15].

Blocked threads

A slow service can stop its callers even when no one retries. Microsoft’s microservices guide describes a web application that calls an ordering service with synchronous requests and no timeout [12]. If the ordering service stops responding, each request to it holds a thread of the web application while it waits. With enough of them blocked, the runtime of the application can eventually exhaust its supply, so the whole application stops responding instead of only the part that uses the ordering service [12]. When a dependency fails under heavy traffic, the waiting requests can quickly use up the request threads of every service in the chain and bring down the whole application [12].

Scaling one part overloads another

Adding capacity can move a failure instead of removing it. The cloud guide tells designers to scale in sets of resources: before scaling one service out a long way, they should ask what that will do to the data stores, caches and other services it depends on, because some of those resources can grow in proportion and many cannot [11]. A service with ten times as many instances can send ten times as many queries to a database that has not grown (our example).

Limiting the damage

The defences in the sources have one principle in common (our reading): when a dependency is failing, send it less work, not more.

  • Timeouts. In general, a client should not wait without limit for a reply, and should always use a timeout; with a timeout, resources such as threads and connections are never held indefinitely [13].

  • Backoff and jitter. A client should wait longer before each new retry, and should use a jitter strategy to spread the waits so that many clients do not retry at the same moment [10, 15].

  • Circuit breakers. A client counts failed requests to a service, and after a set number of failures it stops sending requests for a while and fails them immediately. From time to time it lets one trial request through, and if that succeeds it starts sending requests normally again [10, 13]. In the cloud guide’s example the client stops after 100 failed requests and allows one trial request every 30 seconds [10]. The cloud guide says an application typically combines the two, making its retries through a circuit breaker [10]; the circuit-breaker page says an application can combine them, and that the retrying code should stop once the circuit breaker reports the fault as non-transient [14].

  • Bulkheads and limits on queued requests. A client limits how many requests it can have outstanding to any one service; when the limit is reached, further requests are probably of no use and should fail at once [13]. The guide notes that with such a limit, excess load can be shed before the failures arrive, so that in some failure scenarios the response is faster than with a circuit breaker, which has to wait for failures to accumulate [13].

  • Fallbacks. When a request fails, the client can fall back to data from a cache or to a default value. The guide considers this approach suitable for queries; for updates or commands, it says, the approach is more complex [13].

  • Asynchronous messaging. The microservices guide recommends that internal services communicate through messages, not long chains of synchronous calls, and says that the chained design “will eventually become the main cause of bad outages” [13].

  • Careful scaling. The cloud guide recommends scaling out aggressively when load rises and scaling in conservatively, for example waiting five minutes between steps when adding resources, and as long as 15 minutes when removing instances, to keep the system stable [11].

The cloud guide also says that resilience cannot always be tested in the same way as ordinary functionality, with unit and integration tests. It recommends testing how the whole system behaves under failure, by deliberately crashing processes, letting certificates expire or making dependent services unavailable, and it calls this chaos testing, naming the chaos-monkey framework as one tool [10].

Why the outages still happen: the article’s assessment

The sources explain the mechanisms; they do not analyse any particular outage, and the corpus contains no incident reports. The following is this article’s assessment, drawn from the points above.

  1. Redundancy protects only against failures that affect one copy. Copies that share a rack, a datacenter or a region can fail together when what they share fails ([11]; the arithmetic section), and so can copies that share a configuration or a version of software (our reasoning). In a large service some things, such as configuration and software versions, are common to many copies, so some failures reach all of them at once (our reading).

  2. Failover depends on detecting failure, and a dead component and a slow one cannot always be told apart [1]. Waiting longer to be sure delays recovery; if the decision is made sooner, work is moved away from components that were still working, and the moved work adds load elsewhere.

  3. Recovering adds load at the moment the system has least capacity: retransmission in the network [5, 6] and retries between services [10, 14].

  4. The protective mechanisms are software and configuration too, and they can fail. The ARPANET failure of 1981 was caused by an early version of its routing protocol [4], and Peterson and Davie list misconfiguration as a common cause of node and link failures [1].

  5. Each extra copy, region and failover procedure adds cost and complexity [11]. The cloud guide says that resilience cannot always be tested the way features are, with unit and integration tests; the whole workload has to be tested under failure conditions, which occur only intermittently, by causing failures on purpose [10].

On this reading, a large service goes down when something its copies share fails, or when the responses to a small failure (retries and failovers) add enough load to cause a larger one. Adding more copies does not remove either risk.

Not covered here

  • Specific outages at named companies: the corpus has no incident reports or news on them.

  • Error-detecting and error-correcting codes for the first class of failure (corrupted bits), in Peterson and Davie §2.4.

  • TCP’s congestion-control algorithms in detail (§6.3), and queueing in routers (§6.2).

  • Interdomain routing policy in BGP and its handling of misconfigured neighbours (§4.1.2).

  • Health checks and monitoring of services, in the microservices guide’s health-monitoring page and the cloud guide’s monitoring chapter.

  • Backup and restore, and the consistency of data copied between regions.

Sources

Peterson and Davie’s book is the open-source edition kept as reStructuredText; its README says v6.0 can roughly be equated with a 6th edition, and the corpus copy is labelled Version 6.2-dev. It has no printed pages; locations are given by its own section numbers and headings. The Microsoft pages are Markdown files from the dotnet docs repository; locations are given by page title and heading.

  • Larry Peterson and Bruce Davie, Computer Networks: A Systems Approach, corpus folder cs-architecture/books/Computer-Networks-Systems-Approach/. Files cited: cs-architecture/books/Computer-Networks-Systems-Approach/foundation/requirements.rst, cs-architecture/books/Computer-Networks-Systems-Approach/internetworking/ethernet.rst, cs-architecture/books/Computer-Networks-Systems-Approach/internetworking/routing.rst, cs-architecture/books/Computer-Networks-Systems-Approach/congestion/issues.rst, cs-architecture/books/Computer-Networks-Systems-Approach/congestion/tcpcc.rst, cs-architecture/books/Computer-Networks-Systems-Approach/applications/infrastructure.rst, cs-architecture/books/Computer-Networks-Systems-Approach/applications/overlays.rst.

  • Microsoft, Architecting Cloud Native.NET Applications for Azure, files.

  • Microsoft, .NET Microservices. Architecture for Containerized.NET Applications, files.

  • [1]Peterson and Davie, §1.2.4 Support for Common Services, under Reliable Message Delivery (foundation/requirements.rst; the three classes of failure; misconfiguration; routing around a failed node or link; failed against slow).

  • [2]Same, §3.2.3 Spanning Tree Algorithm (internetworking/ethernet.rst; the looping packet among S1, S4 and S6; loops added for redundancy; the spanning tree).

  • [3]Same, §3.4.2 Distance-Vector (RIP) (internetworking/routing.rst; detecting a failed link; count to infinity; 16 as infinity; split horizon and poison reverse; waiting before advertising).

  • [4]Same, §3.4.3 Link State (OSPF), under Reliable Flooding and Route Calculation (internetworking/routing.rst; the ARPANET failure; hello packets; stability).

  • [5]Same, §6.1.3 Evaluation Criteria (congestion/issues.rst; stability; congestion collapse).

  • [6]Same, §6.3 TCP Congestion Control, opening (congestion/tcpcc.rst; congestion collapse before congestion control; self-clocking).

  • [7]Same, §9.3.1 Name Service (DNS), under Name Servers (applications/infrastructure.rst; two or more name servers per zone).

  • [8]Same, §9.4.1 Routing Overlays, under Resilient Overlay Networks (applications/overlays.rst; BGP’s routes; RON and the 2001 measurement; scaling limits).

  • [9]Microsoft, Cloud-native resiliency (the list of challenges for a distributed service).

  • [10]Microsoft, Application resiliency patterns (retry with exponential backoff and its example; circuit breaker and its example; the self-imposed denial of service; testing for resiliency).

  • [11]Microsoft, Azure platform resiliency (Design with resiliency; Design with redundancy; Design for scalability).

  • [12]Microsoft, Handle partial failure (blocked threads; the 1:4 ratio; 50 dependencies at 99.99%).

  • [13]Microsoft, Strategies to handle partial failure (asynchronous messaging; retries; timeouts; circuit breaker; fallbacks; limits on queued requests).

  • [14]Microsoft, Implement the Circuit Breaker pattern (retries as a denial of service; retry and circuit breaker combined).

  • [15]Microsoft, Implement HTTP call retries with exponential backoff with IHttpClientFactory and Polly policies, under Add a jitter strategy to the retry policy.

Works cited