BlogProjectsAboutContactSearch posts…
architecture / resilience

Essential Software Resilience Patterns

· 3 min read

Diagram of six software resilience patterns

In modern software development, failure is inevitable. Networks lag, external dependencies crash, and traffic spikes can arrive unexpectedly. To build robust systems, we must design for failure.

Here are the six essential resilience patterns that protect your systems from cascading failures and ensure high availability.


1. Circuit Breaker

  • Core Concept: Stops an application from repeatedly executing an operation that is highly likely to fail.
  • Mechanism: Operates in three states:
    • Closed: Traffic flows normally. Track failures.
    • Open: Traffic is blocked immediately; returns a fast failure without hitting the broken service.
    • Half-Open: Allows a limited amount of traffic through to test if the service has recovered.
  • Real-World Analogy: A household electrical circuit breaker that trips and cuts power when a short-circuit occurs to prevent a fire.
  • Key Benefit: Prevents systemic collapse by temporarily cutting off traffic to a failing downstream service. Saves the failing service from being crushed by traffic so it has time to recover.

2. Retry

  • Core Concept: Automatically repeats a failed request on the assumption that the failure is temporary (transient).
  • Mechanism: Attempts the request again after a delay. Best practices use Exponential Backoff (increasing the wait time with each attempt) and Jitter (adding randomness) to avoid overloading the target system.
  • Real-World Analogy: Redialling a phone number immediately when you get a sudden busy signal or a dropped call.
  • Key Benefit: Overcomes temporary glitches (like brief network drops or blips) without involving the user. The user never knows an error happened because the system silently fixes it on the second try.

3. Timeout

  • Core Concept: Limits the maximum amount of time an application will wait for a response from an external dependency.
  • Mechanism: An internal clock triggers a failure if the network request or database query takes longer than the predefined threshold (e.g., 2000ms), freeing up system resources.
  • Real-World Analogy: Hanging up the phone after waiting on hold for 30 minutes instead of waiting forever.
  • Key Benefit: Frees up system resources by stopping the app from waiting indefinitely for a slow response. Keeps your application fast and responsive; prevents threads or memory from leaking and locking up.

4. Bulkhead

  • Core Concept: Isolates system resources into bounded pools so that a failure in one section does not crash the entire application.
  • Mechanism: Allocates separate thread pools, memory limits, or server instances to different components or user types. If one pool is exhausted, other pools remain unaffected.
  • Real-World Analogy: Dividers built inside a ship’s hull. If water leaks into one compartment, the rest of the ship stays dry and afloat.
  • Key Benefit: Isolates failures to a single compartment, ensuring one broken feature cannot crash the whole app. If the video-streaming feature goes down, users can still browse and purchase items normally.

5. Rate Limiter

  • Core Concept: Restricts the number of requests a user or client can make to a system within a specific window of time.
  • Mechanism: Counts incoming requests against a policy (e.g., 100 requests per minute). Excess requests are rejected with a 429 Too Many Requests HTTP status.
  • Real-World Analogy: A night club bouncer letting only a fixed number of people inside at a time to prevent overcrowding.
  • Key Benefit: Protects against overload by capping the maximum number of requests a user or bot can send. Prevents accidental or malicious traffic spikes (like a DDoS attack) from crashing your database.

6. Fallback

  • Core Concept: Provides a safe, alternative response when a primary mechanism or service fails completely.
  • Mechanism: When a request fails (or a circuit breaker opens), the code immediately catches the error and serves static, cached, or simplified data instead of a generic crash page.
  • Real-World Analogy: A supermarket using a backup battery-powered calculator to ring up items when the main computerized checkout registers lose power.
  • Key Benefit: Maintains a working user experience by providing alternative data when the primary service fails. Instead of a broken page or a 500 error, the user safely sees cached data or a helpful placeholder.

architectureresilience