Why a System Stays Down After the Cause Is Gone - Cold Caches, Queue Backlogs, and Fallbacks on AWS

First Published:
Last Updated:

Sometimes, even after the cause of a problem – such as a surge in load or a failure of a dependency – is gone, a system doesn't immediately return to its normal state. Caches remain empty, queues accumulate messages, and fallback mechanisms continue to operate, often propagating the issue downstream. AWS Well-Architected Framework refers to this lingering state of overload, even after the original trigger is gone, as a "metastable failure."

Even with retry mechanisms, timeouts, and Dead Letter Queue (DLQ) configurations in place, this condition can persist. While retry settings determine how to handle individual failed requests, it's necessary to investigate which components and settings are effective in addressing the lingering effects of empty caches, accumulated queues, and active fallback pathways.

This article categorizes these persistent failure scenarios into three types. For each type, it presents Amazon's experience from the Amazon Builders' Library, AWS recommendations from the AWS Well-Architected Framework, and component specifications from the developer guides. It then analyzes the configurations of ElastiCache, DAX, CloudFront, DynamoDB, RDS Proxy, Application Load Balancer (ALB), SQS, and Lambda, classifying them as configurations that accelerate recovery, those that may prolong recovery, and those not explicitly addressed in the documentation. This article is based on documents reviewed as of December 2, 2026 (during re:Invent 2026) and does not include results from real-world measurements. It does not cover general guidance on retry and timeout settings, explanations of specific incidents, or pricing.

Related articles on this site:

Table of Contents

  1. 1. Scope and Assumptions
  2. 2. What Is a Failure That Stays Down?
  3. 3. Type 1: Cache Dependency
  4. 4. Type 2: Queue Backlogs
  5. 5. Type 3: A Fallback Weaker Than the Primary Path
  6. 6. Inspection Procedure
  7. 7. Frequently Asked Questions About Failures That Stay Down After the Cause Is Gone
  8. 8. Summary
  9. 9. References

1. Scope and Assumptions

This section first defines the intended audience, the scope of this article, the referenced materials, the notation used, and the usage of terminology. The following eight points represent the core conclusions.

  • The definition of "metastable failure" is borrowed from a single sentence in REL05-BP03 of the AWS Well-Architected Framework. The term "metastable" does not appear in the body of the three Amazon Builders' Library articles (caching, queue backlogs, fallback) (Section 2).
  • Recovery is not halted by the incoming load; rather, it is the state that remains after the cause is gone. This article categorizes that state into three scenarios: an empty cache, a queue backlog, and a fallback mode (Section 2).
  • The conditions that trigger an empty cache vary depending on the component. Restarting an ElastiCache Memcached cluster or replacing its nodes results in an empty cache. Valkey and Redis OSS node replacements attempt to preserve data, though with best-effort results. Failures of a primary node without Multi-AZ or replicas result in an empty primary (Section 3.2).
  • CloudFront's request collapsing only aggregates requests with the same cache key. The stale-if-error directive returns stale responses up to the shorter of the directive's value and the maximum TTL (Section 3.3).
  • For SQS, ApproximateAgeOfOldestMessage does not count messages that have been received three or more times without being deleted in standard queues. In FIFO queues, a failed message blocks its message group (Section 4.4).
  • Lambda's SQS event source mappings, when using the default mode for standard queues, gradually increase concurrency up to a maximum of 1,250. Setting MaximumConcurrency above the reserved concurrency may result in throttling. Throttled messages may use up their receive count and be moved to the dead-letter queue (DLQ) (Section 4.5).
  • The Amazon Builders' Library says that Amazon almost never uses fallback in distributed systems and lists five alternative approaches. REL11-BP05 of the Well-Architected Framework describes letting clients bypass a cache during failures as another form of the bimodal trap. The ElastiCache DynamoDB caching client sends requests directly to DynamoDB when the cache is unavailable (Section 5).
  • Inspection should begin with load tests that disable the cache, monitoring message age, calculating the maximum processing capacity during recovery, and deciding whether to run fallbacks all the time or remove them (Section 6).

1.1 Target Audience

This article is intended for architects and SREs who are operating systems that utilize ElastiCache, DAX, and CloudFront in front of SQS, Lambda, DynamoDB, and Aurora in production environments. Specifically, it targets individuals who have experienced or are concerned about incidents where issues persist for tens of minutes even after the cause is gone, and who, despite having already configured retries, timeouts, and dead-letter queues (DLQs), are unsure how to optimize their settings to improve recovery time following an incident.

1.2 What This Article Covers and What It Does Not

The topics covered include: the definition of metastable failure, the three types, the key points of the three Builders' Library articles, a table outlining the configuration of cache and queue components, alternative fallback methods, static stability, inspection procedures, and the checked date.

The following topics are explicitly excluded from this discussion:


This discussion will not cover regional failures and disaster recovery, topics specific to Kafka, Amazon MSK, and Amazon EKS, the internal workings of Aurora buffers, or pricing information.

1.3 Checked Date and Reviewed Materials

The checked date is December 2, 2026. This date falls within the re:Invent 2026 conference (November 30 – December 4, 2026), and the content referenced in this article may change during the conference period. AWS What's New posts up to December 1, 2026, at 17:00 UTC were reviewed, and no announcements were found that would alter the behavior of the components discussed in this article.

The following three categories of materials, each with a different role, were reviewed:

CategoryRole in this ArticleReviewed Materials
Amazon Builders' LibraryAmazon's experience (rules of thumb). Not AWS component specifications.Caching challenges and strategies, Avoiding insurmountable queue backlogs, Avoiding fallback in distributed systems (all three published on December 5, 2019). As supplementary material: Static stability using Availability Zones, Using load shedding to avoid overload.
AWS Well-Architected FrameworkAWS recommendationsREL05-BP01, REL05-BP03, REL05-BP04, REL11-BP05 – a consolidated version combining six pillars, published on November 16, 2026.
Service Developer Guides and API ReferencesComponent specifications (ranges, default values, whether a value is validated).SQS, Lambda, ElastiCache, DAX, CloudFront, DynamoDB, RDS Proxy, Elastic Load Balancing

The pages from the Builders' Library are redirected from aws.amazon.com/builders-library/ to the AWS Builder Center (builder.aws.com). Based on the page bylines and the introduction on the AWS Architecture Blog, the authors are Jas Chhabra for the caching article, David Yanacek for the queue backlog article, and Jacob Gabrielson for the fallback article. The Well-Architected Framework still retains the individual pillar pages from before the consolidation, which are marked as "historical reference only." This article uses the consolidated version's URL and content.

1.4 Indicators of Information Source

This article will apply three indicators to each statement:

IndicatorMeaning
StatedFound in AWS documentation (Builders' Library, Well-Architected Framework, Developer Guides, API Reference, AWS Official Blog).
Not statedNot found within the documents reviewed for this article. This does not constitute proof of non-existence.
InferenceDerived by this article from the information presented in the documents.

Within Stated, the strength of the statement varies depending on the source. Statements in the Builders' Library reflect the experience and preferences of Amazon's teams, often phrased using language like we prefer. Statements in the Well-Architected Framework represent AWS's recommendations. Developer Guides contain a mix of recommendations (We recommend), instructions (imperative verbs), and specifications (ranges, default values, conditions that APIs validate). This article will differentiate between these three categories.

1.5 Usage of Terms

This article distinguishes between the following terms:

  • The cause is gone: The load spike or dependency failure that triggered the failure is no longer present.
  • Recovery: The system returning to its previous response time and throughput prior to the failure. This article focuses on situations where recovery does not occur even after the cause is gone.
  • Fallback: An alternative mechanism used when the primary path fails, aiming to achieve the same result. This article uses it only in the Builders' Library sense.
  • Retry: Sending a failed call to the same entity again. In this article, the term "retry" is used mainly in contexts where it increases load and prevents recovery.
  • Empty Cache: A cache that contains no data, or very little data. Builders' Library refers to the startup of a new server with an empty cache as a "cold start."
  • Message Age: The time elapsed since a message was added to a queue.

The Lambda developer guide, as of the checked date, refers to functions as "Event Functions." This article uses the term "function" instead.

2. What Is a Failure That Stays Down?

2.1 One Sentence in the Well-Architected Framework

Within what this article read, the AWS document that defines metastable failure is the following sentence in REL05-BP03 Control and limit retry calls of the Well-Architected Framework (Stated).

This prevents the backlogs that lead to metastable failures, a state where a system stays overloaded even after the original trigger is gone.

This sentence appears within a paragraph explaining the importance of setting limits on the number of retry attempts or the time elapsed. The same BP also lists as a benefit (Stated) that by implementing such limits, runaway backlogs are prevented and metastable failures are avoided. Therefore, the Well-Architected Framework introduces the concept of metastable failure in the context of limiting retries, although it does not limit the cause to retries (Inference).

The term metastable does not appear even once in the body of the three Builders' Library articles on caching, queue backlogs, and fallback. This is the result of this article's count on the checked date. It also doesn't appear in the supplementary articles 'Static stability using Availability Zones' and 'Using load shedding to avoid overload.' This article therefore borrows the definition from REL05-BP03 and cites the Builders' Library as a reflection of Amazon's experience, describing the same phenomenon using different terminology.

2.2 The Issue Isn't the Incoming Load, But the State That Prevents Recovery

The key point of the definition for REL05-BP03 is that the overload persists even after the original trigger is gone. Even when the incoming load returns to normal, a state remains within the system that continues to generate more work than usual (Inference). This article categorizes this state into three types.

TypeState Remaining After the Cause Is GoneForce Preventing RecoveryPrimary ComponentsSection
Type 1: Cache DependencyEmpty CacheCache misses propagate downstream, causing bottlenecks and preventing the cache from filling.ElastiCache, DAX, DynamoDB caching, CloudFront, DynamoDB, RDS Proxy, ALBSection 3
Type 2: Queue BacklogsAccumulated MessagesProcessing older messages delays the handling of newer messages, preventing overall latency from improving.SQS, Lambda event source mappingsSection 4
Type 3: A Fallback Weaker Than the Primary PathFallback ModeA route typically not used in normal operation places an unusual load on another dependency.Custom switching code, DynamoDB caching clientsSection 5

These three types can overlap. In the case described in the Builders' Library fallback article, a cache failure (Type 1) triggered a fallback that called the database directly (Type 3) (Stated). Retries can add load to any of these three types (Inference).

2.3 Two Modes Common to Three Sources

These three sources describe the same phenomenon as a behavior with two modes (Inference).

  • The Builders' Library caching article focuses on the modal behavior of the cache, specifically how its behavior changes depending on whether the target is present in the cache (Stated).
  • The queue backlog article describes systems that use queues as having two operational modes (bimodal behavior). When there is no backlog, the system operates in a "fast" mode with low delays. However, when the rate of arrival exceeds the processing rate, it transitions to another mode where latency increases continuously (Stated).
  • The Well-Architected Framework's REL11-BP05, "Use static stability to prevent bimodal behavior," defines bimodal behavior as different behavior in normal and failure conditions, and recommends designs that avoid it (Stated).

Figure 1 illustrates two modes for a service that uses a cache in front of it. In the "Warm" mode, the cache handles most read requests, resulting in low load on the downstream components. In the "Cold" mode, cache misses propagate downstream, causing the downstream system to throttle, and client retries add to the load. Because the downstream system cannot respond while it is congested, the cache cannot be populated, and the "Cold" mode persists (Inference).

Two Modes of a Cache-Backed Service
Two Modes of a Cache-Backed Service

3. Type 1: Cache Dependency

3.1 What the Builders' Library Says About Amazon's Experience

The caching article describes a scenario where caching improves response times and costs and dependencies are scaled down accordingly, but when the cache cools down or becomes unavailable, a sudden surge in load can overwhelm both dependencies and services. The article names that state as follows (Stated):

We’ve just described a service that has become addicted to its cache.

The same article, drawing on Amazon's experience, outlines the following (Stated):

  • On-box caching (caching within the process's memory) suffers from cold start issues. New servers start with an empty cache, and during the time it takes to populate the cache, requests to dependencies can surge, creating problems during deployments or when caches are cleared across all servers.
  • External caching solutions (such as fleets of Memcached or Redis) do not experience cold start issues during deployments. However, the availability of the external cache fleet is a characteristic separate from that of the dependencies.
  • Directly calling dependencies when the external cache is unavailable can lead to increased and unusual request volumes directed at the dependencies, potentially causing throttling or performance degradation. Amazon's teams prefer either combining process memory caching with external caching or implementing load shedding to limit the rate of requests sent to the dependencies.
  • If an upstream service doesn't cache anything when receiving an error response, it will continue to send the same request. Caching error responses with a TTL different from successful responses is referred to as negative caching.
  • To address the "thundering herd" problem – a situation where many clients simultaneously request the same resource that is not in the cache – request coalescing is used to limit the number of pending requests for that resource to one.
  • A strategy involving both soft TTL and hard TTL allows a system, when the downstream service is unavailable, to continue using older data until the hard TTL expires.

The list at the end of the article tells readers to validate these safeguards through load tests with caches disabled (Stated).

Run load tests with caches disabled to validate this.

3.2 Conditions Under Which the Cache Is Emptied

The conditions under which the cache is emptied differ depending on the component and configuration. The following details the conditions for each component.

ElastiCache Memcached: When the cluster is restarted, all data is cleared, and the engine restarts from an empty state (Stated). During node replacement, the node is replaced with a new, empty node, and all cached data is lost (Stated, ElastiCache Maintenance Help page).

ElastiCache Valkey and Redis OSS: Node replacement tries to keep existing data on a best-effort basis and requires successful replication (Stated). If the primary node fails in a configuration where Multi-AZ is not enabled, ElastiCache will provision a new primary. If a replica is available, it will synchronize from that replica. If no replica is available, the new primary will start empty, and data will be lost unless restored from a snapshot (Stated).

ElastiCache Durability: In Valkey 9.0 and later, clusters with durability enabled store committed data in the Multi-AZ transactional log. If a node fails, it can recover from that log without requiring a full synchronization from the primary (Stated). With asynchronous writes, up to 10 seconds of uncommitted data may be lost during a failure (Stated). Durability is disabled by default in Valkey 9.0 (Stated). The extent to which durability prevents an empty cache is left to the existing article Durability on Amazon ElastiCache for Valkey.

DAX: If the primary node fails, DAX automatically fails over to a read replica, designating it as the new primary (Stated). For production use, AWS strongly recommends deploying clusters with three or more nodes across separate Availability Zones, stating that one-node and two-node clusters are not fault-tolerant (Stated). These smaller clusters may become unavailable or lose cached data in the event of a software or hardware error (Stated). The behavior of the cache after a complete cluster loss is not documented in the pages consulted (Not stated). It is inferred that DAX nodes restart without any data in memory, although this is not explicitly stated in the documentation (Inference).

ElastiCache DynamoDB caching: Announced on November 17, 2026, this feature allows ElastiCache Serverless for Valkey to function as a write-through cache in front of DynamoDB (Stated). Cached items expire based on their TTL, with a default value of 5 minutes (between 1 and 86,400 seconds) (Stated). The conditions under which the entire cache is cleared were not found in the pages this article read (Not stated).

CloudFront: Edge caching retrieves items from the origin when the TTL expires (Stated). The conditions under which the entire edge cache is cleared are outside the scope of this article.

3.3 Settings That Reduce Load on Downstream Systems, and Their Conditions

There are settings that reduce the load on downstream systems until the system recovers from an empty cache. However, all of these settings are subject to specific conditions.

CloudFront Request Collapsing: When a request for an object not found in the edge location's cache reaches the edge location, and subsequent requests for the same object arrive before the initial request's response is returned, CloudFront will temporarily pause these later requests before forwarding them to the origin, and will return the response from the initial request to all clients (Stated). This behavior is described identically for both S3 origins and custom origins. Request collapsing only applies to requests that share the same cache key (Stated).

CloudFront only collapses requests that share a cache key.

If headers, cookies, or query strings are added to the cache key, all requests with a different key are sent to the origin (Stated). Using the managed caching policy CachingDisabled will disable both caching and request collapsing (Stated). Therefore, in distributions with highly granular cache keys, requests originating from an empty cache may reach the origin without being collapsed (Inference). Details regarding the addition of layers using Origin Shield can be found in Section 6 of the existing Amazon CloudFront Origin Architecture Guide.

CloudFront's stale-if-error: When the origin is unreachable, or returns an error code between 500 and 600, CloudFront can serve stale (expired) cached content (Stated). The duration for which stale content can be served is determined by the shorter of either the stale-if-error value or CloudFront's maximum TTL (Stated). This setting allows you to serve older responses to users until the origin becomes available again (Inference).

CloudFront Error Caching: CloudFront caches the 4xx and 5xx codes returned by the origin that are in the list on the page (Stated). The caching duration is determined by the longer of two values: the minimum TTL for error caching (default 10 seconds) and the max-age or s-maxage value specified in the Cache-Control header returned by the origin in the initial error response (Stated). It does the same job as the Builders' Library negative cache, as a CloudFront setting (Inference).

DAX's Two Caches: DAX maintains two separate caches: an item cache that stores the results of GetItem and BatchGetItem operations, and a query cache that stores the results of Query and Scan operations (Stated). The query cache does not reflect writes, whether performed through DAX or directly to the table, until the TTL expires (Stated).

DynamoDB caching negative caching: A request for data that is in neither DynamoDB nor the cache creates a negative cache entry (Stated). Negative caching is enabled by default, and the default TTL for negative cache entries is 60 seconds (ranging from 0 to 86,400 seconds, with 0 indicating disabled) (Stated).

DynamoDB On-Demand and Warm Throughput: DynamoDB, which receives the cache misses, does not scale without limit at once either. On-demand tables can immediately handle traffic up to twice the previous peak (Stated). If traffic exceeds twice the previous peak within 30 minutes, throttling may occur (Stated). New on-demand tables can sustain up to 4,000 write operations and 12,000 read operations per second (Stated). Warm throughput is the amount of read and write operations a table can immediately handle, and can be raised in advance through pre-warming (Stated). If the cache is absorbing most of the normal read traffic, the previous peak for the table may be observed as a small value behind the cache. Reads while the system recovers from the empty cache may then exceed that 2x range (Inference).

RDS Proxy: RDS Proxy manages connections from the connection pool, queuing or throttling connection requests that cannot be served immediately, and it rejects connection requests that exceed the limits you specify. The page calls this load shedding (Stated). The time a request waits for a connection in the pool is ConnectionBorrowTimeout, which defaults to 120 seconds (Stated). While this protects the database from excessive connections, the timeouts and retries of callers that were kept waiting can add load of their own (Inference).

ALB Slow Start: In target groups with slow start enabled, requests to healthy targets are increased linearly over a configured period (from 30 to 900 seconds; the default is 0 seconds, which disables it) (Stated). It cannot be used with the least outstanding requests and weighted random routing algorithms (Stated). Furthermore, the documentation states the conditions under which slow start is initiated (Stated):

Newly registered targets enter slow start mode only when there is at least one healthy target that is not in slow start mode.

If a target is registered with a single registration operation to an empty target group, it will not enter slow start mode either (Stated). Consequently, during recovery from a failure that replaces every target, slow start may not protect new targets whose caches have not warmed up (Inference).

3.4 Table 1: Cache Type Components and Configurations

Table 1 sorts the settings in Sections 3.2 and 3.3 by their effect on recovery. This article classified the Effect column from what the pages say (Inference). Speeds recovery indicates settings that can accelerate recovery, Prolongs recovery indicates conditions that may extend recovery, and Not stated signifies that the pages say nothing about it.

Component and ConfigurationPage Description (Summary)EffectSource
ElastiCache Memcached RestartClears all data and starts with an empty cluster.Prolongs recoveryDeveloper Guide
ElastiCache Memcached Node ReplacementReplaced with a new, empty node.Prolongs recoveryElastiCache Help Pages
ElastiCache Valkey and Redis OSS Node ReplacementKeeps data on a best-effort basis.Speeds recovery (if data is preserved)Developer Guide
ElastiCache Primary Failure (without Multi-AZ or Replicas)New primary starts empty.Prolongs recoveryDeveloper Guide
ElastiCache Durability (Valkey 9.0 and later)Restored from transactional logs. Disabled by default in Valkey 9.0.Speeds recoveryDeveloper Guide
DAX Read ReplicaFails over to the replica in the event of a primary failure. Strongly recommended to use 3 or more nodes.Speeds recoveryDeveloper Guide (including a recommendation)
DAX Cluster-Wide LossNot stated.Not stated—
DynamoDB Caching: Conditions for Complete Cache ClearingNot stated. Default TTL for items is 5 minutes.Not statedDeveloper Guide
DynamoDB Caching: Negative CachingEnabled by default. Default negative TTL is 60 seconds.Speeds recoveryDeveloper Guide
CloudFront Request CollapsingOnly combines requests with the same cache key. Stops when CachingDisabled is enabled.Speeds recovery (when cache keys are the same)Developer Guide
CloudFront stale-if-errorServes stale content up to the shorter of the value and the maximum TTL.Speeds recoveryDeveloper Guide
CloudFront Minimum TTL for Error CachingDefault is 10 seconds.Speeds recovery (when the origin's error response has a short max-age)Developer Guide
DynamoDB On-DemandMay be throttled if usage exceeds twice the previous peak within a 30-minute window.Prolongs recovery (if the previous peak was low)Developer Guide
DynamoDB Warm ThroughputCan be raised in advance.Speeds recoveryDeveloper Guide
RDS Proxy Connection LimitRejects connections exceeding the limit (load shedding).Speeds recovery (protects the database)Developer Guide
ALB Slow StartRanges from 30 to 900 seconds. Only activated when at least one target is healthy and not in slow start.Speeds recovery (when healthy, non-slow-start targets remain. May not activate during a complete replacement)Developer Guide, API Reference

4. Type 2: Queue Backlogs

4.1 What the Builders' Library Says About Amazon's Experience

The queue backlog article notes that while queues are added to improve availability, they can greatly extend recovery time after an outage, and rephrases this behavior as follows (Stated):

Putting it another way, a queue-based system has two modes of operation, or bimodal behavior.

The same article states that recovering from a one-hour processing outage requires double the normal capacity for another hour after the recovery (Stated). It also provides an example: it takes operators 30 minutes to notice a surge from one customer and respond, and if the accumulated volume is ten times the consumer's capacity, it will take 300 minutes to work through the backlog (Stated).

The methods used in Amazon's systems, as described in the article, are as follows (Stated):

  • Processing delays are measured by the age of messages within the queue. AWS IoT uses a metric called AgeOfFirstAttempt, which measures only the age of the initial delivery attempt.
  • High-volume customers and older messages are moved to a separate queue (a "spillover queue" or "backlog queue"), allowing newer messages to be processed first. This method of setting older messages aside is referred to as an approximation of Last-In, First-Out (LIFO) order.
  • In systems with regular full synchronizations (anti-entropy sweepers), older messages are discarded.
  • Backpressure is sent upstream to the producers. Delay queues are used to put work off until later.
  • Keep the limit on in-flight messages in mind, and either stop processing or send heartbeats so that processing does not continue beyond the visibility timeout.

In its list of design patterns for Amazon's systems, the same article describes the preference of real-time systems as follows (Stated):

Real time systems often are implemented with FIFO-ish queues, but prefer LIFO-ish behavior.

The queue backlog article describes the polling behavior of SQS FIFO queues using figures as of 2019. This article does not present those figures as current specifications; instead, it uses descriptions from the current developer guide, as detailed in Section 4.4.

4.2 What the Well-Architected Framework Recommends

REL05-BP04 Fail fast and limit queues recommends practices aligned with the Builders' Library regarding queue backlogs (Stated).

  • The risk of a backlog arises when a queue continues to hold requests that clients have already timed out and abandoned. The depth of the queue and the age of messages are more critical than the processing volume itself.
  • When strict ordering is not required, approximate Last-In, First-Out (LIFO) behavior by processing new requests while allowing older jobs to wait. Excess or older traffic can be diverted to a "spillover" queue as an approximation.
  • For each message retrieved, calculate an age indicator by comparing the current time with the message's timestamp, and set up alerts based on increasing age.
  • If permissible, discard older messages that are no longer relevant to the requesting client.

No configuration for delivering messages in LIFO order was found in the SQS developer guide pages this article read (Not stated). The LIFO behavior described in both the Builders' Library and the Well-Architected Framework is an approximation where consumer-side code examines message age and moves them to a different queue (Stated).

4.3 Figure 2: A Queue After an Outage

Figure 2 illustrates two different approaches to processing messages that have accumulated after a disruption. The diagram does not include numerical values. When processing messages from oldest to newest using a single queue (as shown in the upper section), newly arriving messages are added to the back of the queue, so the wait time for new requests will not decrease until the backlog is cleared. However, if older messages are moved to a separate queue (as shown in the lower section), the wait time for new requests returns to normal more quickly. The older messages can then be processed when there is available capacity (Inference, built from REL05-BP04 and the Builders' Library).

A Queue After an Outage
A Queue After an Outage

4.4 SQS Configuration

Visibility Timeout: The default is 30 seconds, and can be extended up to a maximum of 12 hours from when the message is first received (Stated). Messages that are not deleted before the timeout expires become visible in the queue again (Stated).

Retention Period: The default is 4 days, and can be configured between 60 seconds and 1,209,600 seconds (14 days) (Stated).

DLQ Retention Period: For standard queues, the message's expiration time is determined by the time it entered the original queue, and does not change when it is moved to the DLQ (Stated). Therefore, the page calls it a best practice to set the DLQ retention period longer than the original queue (Stated). For FIFO queues, the timestamp resets when a message is moved to the DLQ (Stated).

In-Flight Limit: The number of messages currently being processed (received but not deleted) is approximately 120,000 for standard queues, and can vary depending on queue throughput and message backlog (Stated). When the limit is reached, short polling requests will return an OverLimit error, while long polling returns no error and simply returns no new messages (Stated). For FIFO queues, the limit is determined by the number of active message groups (Stated).

Behavior of ApproximateAgeOfOldestMessage: This metric indicates the age of the oldest unprocessed message (Stated). However, for standard queues, a message that is received three or more times without being deleted is moved to the back of the queue, and the metric reflects the age of the next message that has not reached that count (Stated). Repeatedly received messages that are not deleted (often referred to as "poison pill" messages) are excluded from this metric until they are successfully processed (Stated). FIFO queues do not reorder messages, and a failed message blocks its message group until it is deleted or expires (Stated).

Each page words this reordering condition differently. The page regarding metrics states that the reordering happens even when a redrive policy is in place. The page discussing DLQs describes it for standard queues with a redrive policy whose maxReceiveCount is greater than 3 (Stated). Either way, messages that repeatedly fail processing on a standard queue are hard to see in the age metric (Inference). Relying only on age-based alerts may lead to overlooking a backlog of poison-pill messages, so it is necessary to monitor the number of messages in the DLQ separately (Inference). The metrics page recommends using ApproximateNumberOfMessagesVisible to monitor DLQ status (Stated).

Fair Queues: SQS fair queues are designed for multi-tenant queues, prioritizing message delivery for other tenants when one tenant consumes a disproportionately large share of the consumer's capacity (Stated). The page suggests considering fair queues when the queue is multi-tenant, experiences high traffic, and the dwell time is a factor in service quality (Stated). Using fair queues provides metrics that exclude noisy groups, such as ApproximateAgeOfOldestMessageInQuietGroups (Stated). It is SQS's answer to the problem the Builders' Library describes: in one shared queue, it is hard to separate one workload from another (Inference).

4.5 Lambda's SQS Event Source Mappings

Scaling Limits: Event source mappings that read from standard queues in default mode begin with five concurrent invocations. If messages remain, the number can increase by a maximum of 300 per minute, up to a maximum of 1,250 concurrent invocations (Stated). When the account's concurrency quota is the default 1,000, an SQS event source mapping also scales only up to that value unless you specify MaximumConcurrency (Stated). For FIFO queues, the number of concurrent invocations is limited by the smaller of either the number of message group IDs or the MaximumConcurrency setting (Stated). The provisioned mode has a separate scaling limit, and cannot be used in conjunction with MaximumConcurrency (Stated). Details on scaling behavior can be found in the published AWS Lambda Concurrency and Scaling Guide, and information on provisioned mode for Kafka and SQS is available in the published Lambda Event Pollers in Provisioned Mode for Kafka and SQS.

This limit is also the upper limit on how fast an accumulated queue can be drained (Inference). Increasing from 5 to 1,250 by 300 per minute takes a little over four minutes to reach the maximum (Inference, calculated from the page's numbers). If the volume accumulated during the outage greatly exceeds what 1,250 concurrent invocations can process, recovery takes time, as in the Builders' Library discussion of doubling capacity (Inference).

MaximumConcurrency and Reserved Concurrency: MaximumConcurrency is an integer between 2 and 1,000, and it limits the number of concurrent invocations that the SQS event source can trigger for the function (Stated). The documentation gives the following instruction (Stated):

Don't set maximum concurrency higher than the function's reserved concurrency.

If the sum of all SQS event source MaximumConcurrency settings exceeds the function's reserved concurrency, Lambda may throttle messages (Stated). An AWS Compute Blog post (January 2023) discussing MaximumConcurrency states that when the function's concurrency reaches the reserved concurrency limit, messages are returned to the queue and either retried according to the redrive policy, expire after a retention period, or are sent to a dead-letter queue (DLQ) (Stated).

From this, a chain during recovery can be assembled. When the function is throttled while trying to drain an accumulated queue at once, healthy messages use up their receive count, reach maxReceiveCount, and are moved to the DLQ. After the cause is gone, the work of moving them back from the DLQ remains, and recovery takes longer (Inference).

Three rules on the visibility timeout: The Lambda pages contain three rules of different strength.

RuleStrength of the page's wordingValidated?
Set the queue's visibility timeout to at least six times the function's timeout.Page instruction (imperative). When a batching window is used, the page recommends adding its value as well.Not validated
The function's timeout must be less than or equal to the queue's visibility timeout.SpecificationLambda validates this when an event source mapping is created or updated, and returns an error if the condition is not met. It does not validate this when the function's timeout is changed.
Set the maxReceiveCount in the redrive policy to 5 or greater.Recommendation (We recommend)Not validated

The documentation explains that the six-fold buffer accounts for the time Lambda takes to retry when the function is throttled (Stated). The maximum timeout for functions that run on demand is 1,800 seconds (30 minutes) as of the checked date (Stated, AWS Compute Blog, November 2026). Applying a six-fold multiplier to a 30-minute function results in a visibility timeout of 3 hours, meaning it may take up to 3 hours for messages in a failed batch, or lost during processing, to become visible again (Inference). If the function timeout is extended before the visibility timeout, it is possible to exceed the visibility timeout without validation, potentially causing messages to reappear during processing (Stated). The documentation advises extending the visibility timeout before extending the function timeout (Stated).

4.6 Stream Event Source Mappings

Kinesis and DynamoDB Streams event source mappings offer a setting to discard older records. MaximumRecordAgeInSeconds specifies the age threshold beyond which records are discarded, while MaximumRetryAttempts determines the number of retry attempts before a record is discarded (Stated). Both settings default to -1 (infinite), meaning that failed records will continue to be retried until the record expires (Stated). The range for MaximumRecordAgeInSeconds is -1 to 604,800 (Stated).

If left at their default values, a batch that keeps failing can halt a shard's processing, potentially causing the age of the records behind it to keep increasing (Inference). Discarding older records to move on is close to the Builders' Library method of dropping old messages (Inference). Details regarding the configuration options for sending discarded records to a failure destination, and the specific differences between these destinations, are left to the existing article What Happens to a Failed Batch in a Lambda Event Source Mapping. No setting that discards messages by age was found for SQS event source mappings (Not stated). In SQS, messages either expire based on their retention period, or the consumer's code discards messages based on their age (Inference).

4.7 Table 2: Queue-Type Components and Settings

In Table 2 as well, this article classified the Effect column from what the pages say (Inference).

Component & SettingsPage Description (Summary)EffectSource
SQS Visibility TimeoutDefault 30 seconds, maximum 12 hoursProlongs recovery (If too long, re-delivery of lost messages may be delayed.)Developer Guide
SQS Retention PeriodDefault 4 days, 60 seconds to 14 daysNot stated (No effect described regarding recovery.)Developer Guide
SQS DLQ Retention PeriodFor standard queues, retains the original timestamp. It's best practice to configure a longer retention period.Speeds recovery (Prevents loss of messages within the DLQ.)Developer Guide
SQS In-Flight LimitApproximately 120,000 for standard queuesProlongs recovery (Messages that are inadvertently left undeleted may consume the limit.)Developer Guide
ApproximateAgeOfOldestMessageFor standard queues, does not count messages received three or more times and not deleted. For FIFO queues, a failed message blocks its group.Prolongs recovery (Relying solely on age alerts may miss a backlog of poison-pill messages.)Developer Guide
SQS Fair QueuesPrioritizes other tenants when a noisy tenant is present.Speeds recovery (Reduces wait times for other tenants.)Developer Guide
SQS LIFO ConfigurationNot described. LIFO is an approximation on the consumer side.Not stated—
Scaling of Lambda SQS Event Source MappingsStandard queue, default mode: starts at 5 and adds up to 300 per minute, up to a maximum of 1,250.Prolongs recovery (Limits the rate at which messages can be processed.)Developer Guide
MaximumConcurrency2 to 1,000. Do not exceed the reserved concurrency.Speeds recovery (Protects downstream services.) / Prolongs recovery (If greater than reserved concurrency, throttling may occur.)Developer Guide, API Reference
Throttled MessagesMessages are returned to the queue and may be moved to the DLQ according to the redrive policy.Prolongs recoveryAWS Compute Blog
6 Times Visibility TimeoutPage instruction. Not validated.Speeds recovery (Leaves time for retries when throttling occurs.)Developer Guide
maxReceiveCount of 5 or moreRecommendedSpeeds recovery (Makes it less likely that healthy messages will be sent to the DLQ.)Developer Guide
MaximumRecordAgeInSecondsDefault -1 (infinite), -1 to 604,800Speeds recovery (When configured.)API Reference

5. Type 3: A Fallback Weaker Than the Primary Path

5.1 What the Builders' Library Says About Amazon's Experience

The fallback article divides strategies for handling critical failures into four categories: retry, proactive retry (sending requests in parallel and using the first response), failover, and fallback. It says that Amazon almost never uses fallback (Stated). The reason cited is that fallback strategies in distributed systems are difficult to test, prone to failure themselves, can exacerbate issues, and offer a return that isn't worth the risk, often harboring latent bugs. On making outages worse, it says (Stated):

Distributed fallback strategies often make the outage worse.

The article also describes an outage on Amazon's retail site around 2001. To display shipping speeds, a caching process was placed on each web server. If the cache was unavailable, the server would directly query the database. Months later, the caches all failed at about the same time, causing all web servers to directly query the database, which ultimately resulted in the database failing, bringing down the entire site and its fulfillment centers (Stated). The article points out the contradiction: if directly querying the database is more reliable than using a cache, then the cache is unnecessary (Stated).

Instead of fallback, the article lists five alternative approaches (Stated):

  1. Improve the reliability of the primary path itself, using highly available databases instead of fallback between two data stores.
  2. Return failures to the calling side, allowing the calling side to handle them (e.g., through retries).
  3. Push the data required to respond to a request in advance. Credentials for IAM roles for EC2 are pushed to each instance in advance and remain valid for many hours.
  4. Transform fallback into failover. Keep both the primary path and the fallback path active in production, treating both as valid sources of data.
  5. Ensure that retries and timeouts do not become fallback mechanisms. Monitor retry rates, and send redundant requests all the time, as proactive retry does.

5.2 What the Well-Architected Framework Recommends

REL05-BP01 Implement graceful degradation to transform applicable hard dependencies into soft dependencies recommends ensuring that even when dependencies are unavailable, components can continue to provide core functionality using older data, alternative data, or reduced responses (Stated). It also states the following regarding fallback logic (Stated):

Fallback logic that is never exercised tends to be broken by the time you need it, and it can introduce failure modes of its own.

REL05-BP01 recommends keeping degraded pathways simpler than the primary path and testing them as frequently as production code (Stated). While Builders' Library's fallback attempts to achieve the same result through an alternative mechanism, REL05-BP01's reduced response aims to reduce the result itself. Because the former shifts load to a different dependency while the latter reduces load, their effects on recovery can be opposite (Inference).

REL11-BP05 defines static stability in a single sentence (Stated):

A statically stable workload behaves the same way whether or not a failure is occurring.

The same BP also notes that letting clients bypass a cache during failures is another form of the bimodal trap (Stated):

Letting clients bypass a cache during failures is the same trap in another form.

REL11-BP05 recommends a constant work design that, instead of reacquiring state during a failure, refreshes state on a fixed cadence and, when a call fails, uses the last cached value and raises an alarm (Stated). The Builders' Library fallback article does not use the term static stability (Not stated). "Static stability" is a term used in both the Well-Architected Framework's REL11-BP05 and another Builders' Library publication, "Static stability using Availability Zones." The design for caching control plane responses is detailed in Section 7.3 of the existing AWS Postmortem Case Studies and Design Lessons.

5.3 Fallbacks Built into AWS Components

ElastiCache DynamoDB caching includes a fallback in its client library (Stated).

If the serverless cache is temporarily unavailable or the client connection times out, the ElastiCache integration client falls back to sending requests to DynamoDB directly.

When the cache becomes available again, the client automatically resumes sending requests to the cache. The fallback timeout is configurable, and the fallback can also be disabled (Stated).

This is the same shape of path as the 2001 case in the Builders' Library (Inference). The page does not say which setting is better (Not stated); the material for deciding is on the DynamoDB side, in Section 3.3. In a configuration where the cache handles the majority of read requests, a scenario where all clients simultaneously attempt to read directly from DynamoDB could generate a load exceeding twice the previous peak and the warm throughput (Inference). If the fallback is left enabled, one way to decide is to conduct load testing with the cache disabled to verify that DynamoDB can handle the increased load. If not, options include increasing the warm throughput or disabling the fallback and returning errors to the calling application (Inference, built from the Builders' Library and REL11-BP05).

The companion article AZ Affinity Routing in Route 53 - Which Record Answers and When It Falls Back uses "fall back" for Route 53 answering with a record for a less specific location. That is a step in how a record is chosen, not an alternative path weaker than the primary path.

6. Inspection Procedure

The following procedure outlines an inspection sequence that combines Amazon's experience from the Builders' Library, recommendations from the Well-Architected Framework, and specifications from the developer guide. This article arranged the order of these steps (Inference). The rationale for each step is provided in parentheses.

  1. Conduct load testing with caching disabled (Amazon's experience in the Builders' Library). Measure the load downstream receives when the cache is empty, and compare it to twice DynamoDB's previous peak, the warm throughput, the RDS Proxy connection limit, and the database's capacity.
  2. Document the conditions under which the cache becomes empty, on a component-by-component basis (as specified in the developer guide). Verify which rows in Table 1 apply to your configuration (e.g., Memcached restart, primary without replicas, durability disabled, DAX with two or fewer nodes).
  3. Verify the relationship between cache keys and request collapsing (as specified in the developer guide). Check if CloudFront's cache key includes headers, cookies, or query strings, and if the CachingDisabled setting is being used. Compare the stale-if-error value, the maximum TTL, and the minimum TTL for error caching, with the time the origin needs to come back.
  4. Measure the age of messages and establish alerts (based on Builders' Library experience and REL05-BP04 recommendations). Be aware that ApproximateAgeOfOldestMessage has certain characteristics related to standard queue reordering and poison-pill exclusion. Also monitor the DLQ's ApproximateNumberOfMessagesVisible, along with the number of in-flight messages.
  5. Calculate the maximum processing capacity during recovery (as specified in the developer guide). The lowest value among the following determines the maximum rate at which backlog can be processed (Inference): the rate of increase in event source mappings, the MaximumConcurrency setting, the reserved concurrency, and the downstream capacity. Ensure that MaximumConcurrency is not greater than the reserved concurrency.
  6. Determine how to handle older messages (based on Builders' Library experience and REL05-BP04 recommendations). If strict ordering is not required, consider routing older messages to a separate queue, or implement a process on the consumer side to discard messages that are no longer needed. If it is acceptable to discard older records in a stream, configure MaximumRecordAgeInSeconds.
  7. Run fallbacks all the time, or remove them (based on Builders' Library experience and REL05-BP01 recommendations). If there are paths that are not used in normal operation, consider switching to a failover that is always enabled in production, or replacing it with a reduced response. Alternatively, disable it and return an error to the caller. Include the DynamoDB caching client's fallback setting in this decision.
  8. Set limits on retries (as recommended in REL05-BP03). Establish a limit on the number of retries or the elapsed time, to prevent any of the three types from continuously adding load. General configuration guidance is left to the existing articles listed in Section 1.2.

7. Frequently Asked Questions About Failures That Stay Down After the Cause Is Gone

Q1. Is "metastable failure" a term defined by Builders' Library?

No, not within what this article read. The word metastable does not appear in the body of the three Builders' Library articles on caching, queue backlogs, and fallback. This article uses the definition from Well-Architected Framework's REL05-BP03, which describes a state where overload persists even after the original trigger is gone.

Q2. Does an ElastiCache cache stay populated after a failure?

It depends on the configuration. Memcached will clear the cache upon both restarts and node replacements. While Valkey and Redis OSS attempt to preserve data during node replacements, a new primary node starts empty if the primary fails in a configuration without Multi-AZ or replicas. Valkey 9.0's durability is disabled by default.

Q3. Does CloudFront request collapsing prevent a surge of requests from reaching the origin?

It only handles requests with the same cache key. If the cache key includes headers, cookies, or query strings, all requests with different keys will be sent to the origin. Using a CachingDisabled cache policy will also disable request collapsing.

Q4. Can SQS deliver messages in a LIFO (Last-In, First-Out) order?

No configuration to deliver messages in LIFO order was found in the SQS developer guide pages this article read. The LIFO mentioned in Builders' Library and Well-Architected Framework's REL05-BP04 is an approximation where the consumer code moves older messages to a different queue based on their age.

Q5. Is an alarm on ApproximateAgeOfOldestMessage enough to detect backlogs without missing any?

There are cases where this may not be sufficient. In standard queues, messages that are received three or more times without being deleted are moved to the back of the queue, and the metric reflects the age of the next message. "Poison pill" messages are excluded from this metric until they are processed. Monitor both the number of messages in the DLQ and the number of in-flight messages.

Q6. Should fallback mechanisms be avoided?

Builders' Library notes that while Amazon almost never uses fallback mechanisms for distributed systems, it does not prohibit them. If a fallback is absolutely necessary, it says Amazon exercises it as often as possible in production, maintaining a level of reliability comparable to the primary path. The Well-Architected Framework's REL05-BP01 recommends graceful degradation, where core functionality continues with a reduced response, and suggests testing that degraded path with the same frequency as production code.

8. Summary

In a failure that stays down after the cause is gone, the state left behind, not the incoming load, stops recovery. This article categorizes these states and component settings as follows:

TypePersistent StateConfigurations that may accelerate recoveryConditions that may prolong recoveryNot stated in the pages
Type 1: Cache DependencyEmpty CacheElastiCache replicas and durability, DAX with 3 or more nodes, CloudFront request collapsing, stale-if-error, and error caching, DynamoDB warm throughput, RDS Proxy connection limitsMemcached restart and replacement, primary node without replicas, DynamoDB on-demand mode with a low previous peak, granular cache keysDAX cluster-wide loss, conditions under which DynamoDB caching completely clears
Type 2: Queue BacklogsAccumulated MessagesConsumer-side processing that moves older messages aside, fair queues, maxReceiveCount of 5 or more, MaximumRecordAgeInSecondsLimits on the growth of event source mappings, MaximumConcurrency exceeding the reserved concurrency, movement to a dead-letter queue (DLQ) due to throttling, excessively long visibility timeoutSQS LIFO (Last-In, First-Out) configuration, a setting in SQS event source mappings that discards older messages
Type 3: A Fallback Weaker Than the Primary PathFallback ModeImprove the reliability of the primary path, switch to failover, reduced responses, constant workFallbacks not used in normal operation, bypassing cache during failuresDetermining the appropriate client-side fallback strategy for DynamoDB caching

  • The definition of metastable failure can be found in the Well-Architected Framework, specifically REL05-BP03. The three Builders' Library articles describe the same phenomenon, referring to it as being "addicted to its cache," exhibiting "bimodal behavior," or experiencing fallbacks making outages worse.

  • The entries in the Builders' Library reflect Amazon's experience, while the text in the Well-Architected Framework outlines AWS's recommendations. The values presented in the developer guide represent component specifications. Specifically, a visibility timeout of six times the function timeout is a page instruction, and a function timeout less than or equal to the visibility timeout is a specification validated when an event source mapping is created or updated. A maxReceiveCount of five or greater is a recommended practice.

  • Inspection should begin with load tests conducted with the cache disabled, monitoring message age, calculating the maximum processing capacity during recovery, and deciding whether to run fallbacks all the time or remove them.

  • This article is based on documentation reviewed on December 2, 2026. During the re:Invent 2026 conference, the documentation may be subject to change.

9. References



References:
Tech Blog with curated related content

Written by Hidekazu Konishi