System Design Patterns: From Fundamentals to Real Systems
Vote

0% completed

Timeout

1. The Pattern

A timeout puts a deadline on every network call. If no answer arrives in time, the call is declared failed, and the resources it was holding are released.

Decide up front how long you will wait. Software, strangely, often does not. Here is the uncomfortable default this pattern corrects: many clients wait forever.

Python's popular requests library has no timeout unless you pass one. A raw TCP connection to a machine that silently died can hang for many minutes. Only then does the operating system give up.

The diagram below shows the pattern.

Why is waiting so dange

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%