AP Computer Science Principles · Study guide

Fault Tolerance

AP® Computer Science Principles · Big Idea 4 · Computer Systems and Networks

Fault Tolerance

How redundancy lets a network keep working when parts fail, how to find the weak points in a network, and what that safety costs.

1Failures happen

Cables get cut by construction crews, routers lose power, and storms knock out whole buildings. Parts of complex systems fail at unexpected times, often in groups. The Internet was engineered to keep working anyway: if a device or connection fails, later data is sent by a different route, if one exists. That “if one exists” is what this topic is about.

A system that can support failures and still keep working is fault-tolerant. Fault tolerance matters because it lets people keep using the network while broken parts are repaired.

2Redundancy

Redundancy is including extra components that can take over if other components fail. In a network, the extra components are extra devices and links, and what they provide is more than one path between two connected devices. When one path breaks, data uses another. Because Internet routing is dynamic, routers notice the failure and start using the remaining paths on their own; no one has to plan the new route.

Picture a movie streaming to your laptop when a router along the way fails. Packets that were in that router are lost, and the picture may pause to buffer for a moment. Routers send the next packets around the failure, and TCP, the protocol that makes delivery complete, notices the missing packets and has them sent again. The movie picks up where it left off.

3Finding the weak points

Figure 1. Redundancy in the middle does not help if every path squeezes through one router. Red marks a part whose failure leaves no path.

The method: remove the failed part, then count the paths that are still whole. Here is what happens to the 4 paths from A to B when one part fails:

Part that failsPaths from A to B leftStill connected?
Link R1–R32yes
Link R2–R32yes
Router R21yes
Router R10no: A and B are cut off
Router R40no: A and B are cut off

A part whose failure leaves zero paths is a single point of failure, a vulnerability. In this network that is router R1, router R4, and the two end links. The middle of the network has plenty of redundancy, but it does not help, because every path squeezes through R1 and R4.

4Fixing a weak point

The fix is not “more routers”. It is another path that avoids the vulnerable part.

Figure 2. If R1 fails, A still reaches B through R3; if R4 fails, R2 delivers straight to B. The fix was not more routers but paths that avoid the weak points.

With the two new links, A to B has 13 paths. If R1 fails, 4 paths remain, such as A → R3 → R2 → B. If R4 fails, 4 remain, such as A → R1 → R2 → B. No single failure cuts A off. The two endpoints are still single devices, of course: if the server itself fails, no network can reach it, which is why big services also keep copies of their servers in several places.

Watch for redundancy that is not real. Two cables in the same underground pipe are one path with two wires: one backhoe cuts both. Two servers on one power supply, or two links through one router, have the same problem. For each part, ask: if this one fails, does something still work?

5Comparing network shapes

Figure 3. More links cost more, and buy tolerance: the fewest link failures that can cut some device off rises from 1 to 5.
Shape (6 devices)Links neededFewest link failures that can cut a device off
Line51
Star51
Ring62
Full mesh155

A ring survives any one link failure, because data can go the other way around. But all 15 ways of losing two links split it into two pieces. A full mesh can lose 4 links and still connect everyone, but needs 15 links instead of 6. More independent paths means more fault tolerance, and more cost.

6Cost and benefit

Redundancy costsRedundancy buys
Extra routers and cables that sit mostly unused on a normal dayThe network keeps working when parts fail
More equipment to power, maintain, and repairSpare paths absorb failures that come in groups
More routing choices to manageMore reliability, which helps the Internet grow to more devices and more people

Redundancy often requires additional resources, but it provides fault tolerance. The spare capacity that looks wasted on a good day is what keeps the network running on a bad one. When you evaluate a design, state both sides.

The key idea

Redundancy means extra components, and in a network that means more than one path between devices. If a part fails, data takes another route, so the system is fault-tolerant. A part that every path goes through is a single point of failure. Redundancy costs extra resources, and in return the network stays reliable and can grow.

7Worked examples

Worked Example 1 Count paths after a failure

One link goes down

In the network of Figure 1, the link between R1 and R3 fails. How many paths from A to B remain, and is the failure tolerated?

  1. 1
    Cross out every path that uses R1–R3.
  2. 2
    Left: A → R1 → R2 → R3 → R4 → B; A → R1 → R2 → R4 → B.
Answer: 2 paths remain, so A can still reach B: the failure is tolerated.
Worked Example 2 Find the vulnerability

The school network

A school's laptop and printer connect to one switch. The switch connects to one router, and the router to the Internet service provider (ISP). Which single failures cut the laptop off from the ISP? How could the school reduce the risk?

  1. 1
    There is only one path: laptop → switch → router → ISP.
  2. 2
    Losing any part of it cuts the laptop off; the devices in the middle are the switch and the router.
  3. 3
    A second connection, such as a second ISP line into the router, protects against the ISP link failing; a second router and switch, each with its own links, protect against those devices failing.
Answer: The switch, the router, and every link on the single path. Each one needs a second path around it.
Worked Example 3 Evaluate proposals

Which change helps?

Which change makes the network in Figure 1 more fault-tolerant?

  1. 1
    Upgrade the R1–R2 link from 50 Mbps to 1 Gbps: single points of failure afterward: R1, R4. Faster, not safer: every path still goes through R1.
  2. 2
    Add a router R5 connected only to R1: single points of failure afterward: R1, R4. More devices, but no new way from A to B.
  3. 3
    Add a direct link from A to R3: single points of failure afterward: R4. Creates a path that skips R1, so R1 is no longer a single point of failure.
  4. 4
    Replace R1 with a newer, more reliable router: single points of failure afterward: R1, R4. Less likely to fail, but when it does, A is still cut off.
Answer: Only adding the A to R3 link. Fault tolerance comes from a path that avoids the weak point, not from speed, more devices, or better parts.
Worked Example 4 Reason about a ring

Six devices in a loop

Six devices are connected in a ring. Can every device still reach every other after one link fails? After two?

  1. 1
    With one link down, the loop becomes a line: data between any two devices can still go the other way around.
  2. 2
    With two links down, the loop breaks into two pieces. This happens for all 15 possible pairs of failed links; even two neighboring links leave one device alone.
Answer: One failure: yes. Two failures: no.
Worked Example 5 Explain the trade

Why pay for idle cables?

A manager says a second fiber line to the data center is a waste because it carries almost no traffic. Respond.

  1. 1
    The second line is redundancy: an extra component that takes over if the first fails.
  2. 2
    Failures happen at unexpected times; without the line, one cut would take the data center offline.
  3. 3
    It does cost money to install and maintain, so the question is whether staying online is worth that cost.
Answer: The line is not idle capacity; it is fault tolerance. It costs resources but keeps the system working when the main line fails, as long as it runs along a different route.

8Common mistakes

Common Mistake 1 · Counting devices instead of paths

Adding a router that hangs off R1 adds no new route from A to B. Ask whether a new path appears.

Common Mistake 2 · Confusing faster or newer with fault-tolerant

More bandwidth or a more reliable part changes nothing when that part fails. Only another path does.

Common Mistake 3 · Calling redundancy wasteful

Redundancy costs extra resources, and that is the price of fault tolerance. Describe both the cost and the benefit.

Common Mistake 4 · Trusting copies that share a weak spot

Two lines through one junction box fail together. Redundant parts must not depend on the same single component.

Explain fault tolerance like this

“The network is fault-tolerant because there is more than one path between A and B. If the link from R1 to R3 fails, data can still travel A → R1 → R2 → R4 → B. This redundancy costs extra routers and links, but lets the network keep working when a part fails.”

Name the failure, show the path that remains, and give the cost and the benefit.