liveBook · Manning

Fallback

As explained in The Coder Cafe

A fallback is an alternative behavior or result used when a preferred operation or dependency is unavailable.

A fallback is an alternative behavior used when a preferred operation or dependency is unavailable. It helps a service keep working from the user’s perspective, sometimes at reduced quality. This is graceful degradation: bending rather than failing completely. section 7.0 section 7.5.4

The right fallback depends on what has failed:

  • For an overloaded service, shed load by rejecting or throttling some requests early. Serving a portion of users can be better than allowing every request to time out. section 7.1.2
  • For a backed-up request queue, adaptive LIFO keeps FIFO order normally but processes newer requests first under heavy load, when older requests may already have been abandoned. section 7.2
  • For an unavailable dependency, distinguish hard from soft dependencies. A hard dependency needs a strategy to keep the service running; a soft one can fail without breaking the critical user journey. section 7.5.1

When more capacity makes overload worse

A REST service has a database connection pool of 100 per instance. During a traffic spike, Kubernetes starts more instances, which add connections until the database slows and requests time out. Rejecting some traffic early could instead preserve service for some users. section 7.1.2

A fallback is only useful if it still works when needed. Test it continuously: a path left unexercised for months may be dead code. If dependency downtime becomes invisible to users, a formerly hard dependency can become soft—but maintaining that status takes ongoing effort. section 7.5.4 section 7.8

How The Coder Cafe covers it

How deep it goes
Explains fallback choices through load shedding, queue ordering, and dependency classification, but does not specify a fallback implementation.
Examples
Uses database overload during Kubernetes autoscaling and FIFO-to-LIFO request handling under heavy load.
What you can do after
Practice/perform dependency classification and continuous fallback testing to keep service available when a dependency fails.
How it connects
Connects graceful degradation with load shedding, adaptive LIFO, hard and soft dependencies, and reliability.

Also explained in

Compare how 24 books explain fallback →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Coder Cafe. The section links point to the parts of the book it draws on.