Search Knowledge

© 2026 LIBREUNI PROJECT

Software Architecture / Cross-Cutting Qualities

Runtime Architecture & Resilience

Runtime Architecture & Resilience

Runtime architecture is the shape the system takes when it is under pressure. The Google SRE books and cloud reliability frameworks both stress that reliability is observed under real conditions, not inferred from static structure. Diagrams drawn at rest often hide the important questions: what happens when a dependency is slow, a queue grows, a region loses capacity, a cache is cold, a deployment is bad, or a downstream system rejects traffic?

Distributed systems fail partially. One service can be healthy while its database is saturated. One region can accept traffic while another loses a provider. One dependency can respond slowly enough to exhaust caller threads without technically being down. Senior architecture treats partial failure as normal operating reality.

Code
left to right direction
actor "User" as User
rectangle "Edge" as Edge
rectangle "Application" as App
rectangle "Dependency A\nslow" as A
rectangle "Dependency B\nhealthy" as B
database "Database\nsaturated" as DB
queue "Queue\nbacklog" as Queue

User --> Edge
Edge --> App
App --> A : timeout risk
App --> B : normal
App --> DB : pool exhaustion risk
App --> Queue : delay risk
UserEdgeApplicationDependency AslowDependency BhealthyDatabasesaturatedQueuebacklogtimeout risknormalpool exhaustion riskdelay risk

Failure Modes

A failure mode is a specific way the system can stop meeting expectations. “Database down” is one. “Database slow enough to exhaust connection pools” is better. “Payment provider returns intermittent 500s while checkout retries without jitter and creates duplicate authorization attempts” is the level of specificity that leads to real design.

Failure-mode design asks five questions: how will we detect it, how will we contain it, how will the user experience degrade, how will we recover, and how will we know recovery is complete? These questions should be answered before production incidents write the architecture for you.

Code
rectangle "Failure Mode Design" as FMD {
rectangle "Detect\nmetric, log, trace, synthetic check" as Detect
rectangle "Contain\ntimeout, bulkhead, circuit breaker" as Contain
rectangle "Degrade\nfallback, queue, read-only mode" as Degrade
rectangle "Recover\nretry, replay, failover, rollback" as Recover
rectangle "Validate\nSLO restored, backlog drained, data reconciled" as Validate
}
Detect --> Contain
Contain --> Degrade
Degrade --> Recover
Recover --> Validate
Failure Mode DesignDetectmetric, log, trace, syntheticcheckContaintimeout, bulkhead, circuitbreakerDegradefallback, queue, read-only modeRecoverretry, replay, failover, rollbackValidateSLO restored, backlog drained,data reconciled

Timeouts, Retries, and Idempotency

Timeouts prevent callers from waiting forever. Retries handle transient failures. Backoff and jitter prevent synchronized retry storms. Idempotency ensures that repeating a command does not duplicate side effects. These tactics belong together. A retry policy without idempotency can charge twice, send duplicate emails, create duplicate orders, or corrupt downstream workflows.

Every outbound call should have a timeout that is shorter than the caller’s remaining latency budget. Every retry should have a reason, limit, and backoff. Every side-effecting operation should have an idempotency key or deduplication strategy. These are architectural policies because they shape failure propagation across the system.

Code
left to right direction
rectangle "Caller" as Caller
rectangle "Timeout Budget" as Budget
rectangle "Retry Policy\nlimited, backoff, jitter" as Retry
rectangle "Idempotency Key" as Key
rectangle "Provider" as Provider
database "Dedup Store" as Dedup

Caller --> Budget : checks remaining time
Budget --> Retry : permits retry?
Retry --> Key : repeats safely
Key --> Provider : command
Provider --> Dedup : reject duplicate side effect
CallerTimeout BudgetRetry Policylimited, backoff, jitterIdempotency KeyProviderDedup Storechecks remaining timepermits retry?repeats safelycommandreject duplicate side effect

Bulkheads and Backpressure

Bulkheads isolate failure by separating resource pools. A reporting workload should not exhaust the same database connections required for checkout. A slow partner integration should not consume every worker thread needed for core orders. Bulkheads can be thread pools, connection pools, queues, rate limits, service instances, database replicas, or even team ownership boundaries.

Backpressure tells upstream systems to slow down. Without it, queues grow, latency rises, autoscaling may add more pressure, and eventually the system collapses. Load shedding is a form of honest backpressure: reject low-priority work quickly so critical work can continue. A system that refuses some work can be more reliable than one that accepts everything and fails all of it later.

Code
left to right direction
actor "Users" as Users
rectangle "Ingress" as Ingress
rectangle "Priority Router" as Router
queue "Checkout Workers\nreserved pool" as Checkout
queue "Analytics Workers\nbest effort" as Analytics
database "Primary DB" as Primary
database "Replica" as Replica

Users --> Ingress
Ingress --> Router
Router --> Checkout : critical
Router --> Analytics : shed if overloaded
Checkout --> Primary
Analytics --> Replica
UsersIngressPriority RouterCheckout Workersreserved poolAnalytics Workersbest effortPrimary DBReplicacriticalshed if overloaded

Graceful Degradation

Graceful degradation preserves core value while reducing non-critical behavior. A commerce site may turn off recommendations, delay emails, switch to cached catalog data, or place suspicious orders into review while preserving checkout. A collaboration tool may disable search indexing while preserving document editing. Degradation must be product-designed; engineering cannot invent it during an incident without risking user trust.

Degradation levels should be explicit. Level one may reduce optional features. Level two may enable read-only mode. Level three may restrict traffic to existing customers. Each level needs trigger conditions, user messaging, owner approval, and recovery validation. This turns resilience from heroics into designed behavior.

Code
rectangle "Degradation Policy" as Policy {
rectangle "Level 0\nnormal" as L0
rectangle "Level 1\ndisable non-critical personalization" as L1
rectangle "Level 2\nqueue low-priority writes" as L2
rectangle "Level 3\nread-only or restricted access" as L3
}
L0 --> L1 : dependency latency high
L1 --> L2 : backlog exceeds threshold
L2 --> L3 : error budget burn critical
L3 --> L0 : validation complete
Degradation PolicyLevel 0normalLevel 1disable non-criticalpersonalizationLevel 2queue low-priority writesLevel 3read-only or restricted accessdependency latency highbacklog exceeds thresholderror budget burn criticalvalidation complete

Capacity and Recovery

Capacity is not only average throughput. Tail latency, burst tolerance, queue drain time, cold-start behavior, cache refill, database connection limits, and downstream quotas all matter. A system that handles normal traffic but cannot drain a backlog after a one-hour outage is not resilient.

Recovery is part of architecture. Backups are not enough; restoration must be rehearsed. Multi-region failover is not enough; traffic routing, data replication lag, secrets, certificates, and operational authority must be tested. A retry mechanism is not enough; idempotency and reconciliation must prove that recovery did not duplicate or lose work.

Practice

Pick one critical user journey and write a failure-mode table with five rows: slow dependency, unavailable dependency, database saturation, queue backlog, and bad deployment. For each, define detection, containment, degraded user experience, recovery action, and validation signal.

References & Further Reading