Back to blog

Origin Load Surges After a CDN Cache Purge: How Should You Schedule Purging and Prewarming?

CdnChart EngineeringPublished on 2026-12-0217 min read4,053
Origin Load Surges After a CDN Cache Purge: How Should You Schedule Purging and Prewarming?

A surge in origin load after a CDN cache purge usually does not simply mean that “the CDN is not working.” It indicates an imbalance between invalidated edge caches, the capacity of upper-tier caches to absorb requests, and the origin’s processing capacity. Requests previously served as cache hits now require upstream fetches, while prewarming jobs actively retrieve resources. If timeouts trigger retries, the origin’s actual workload increases further.

Before scheduling purging and prewarming, verify three things: which cached objects were actually cleared, whether the increase at the origin is in request count or transferred bytes, and whether prewarming jobs are competing with real users for the same capacity. When a new release uses new URLs, the usual sequence is to upload and verify the resources, prewarm critical assets, and then switch the entry point. Purging is needed when content at existing URLs must be replaced; keep its scope to the necessary objects and include both the purge and subsequent prewarming in the origin-fetch budget.

If sensitive information has been exposed, permissions are incorrect, or content must be taken down immediately, preventing further delivery takes priority. Do not retain old content merely to reduce load. In other situations, clearing the entire cache at once is generally harder to control and roll back than processing batches by version, path, or object.

Why a Cache Purge Can Push the Origin to Its Capacity Limit

Losing the Cache Adds More Than Download Traffic

A cache hit eliminates an entire processing chain. Fetching static files from the origin may consume outbound bandwidth, connections, and disk reads. Dynamically generated public pages may also involve routing, template rendering, database queries, and third-party APIs. The same number of origin requests can have very different costs for these two types of origin.

That is why CPU alone is not enough to diagnose the problem. A large-file site may have low CPU usage while its outbound connection is already congested. A page-generation service may use little bandwidth while exhausting its database connection pool. Connection queues further increase response times, making CDN or client timeouts more likely and allowing retries to amplify the load.

The HTTP caching guide explains how cache reuse reduces origin processing and notes that managed caches such as CDNs have product-specific behavior. Do not interpret “clear,” “purge,” or “invalidate” solely from the name of a console button. Confirm whether the operation deletes objects, marks them as expired, or allows old copies to remain available for revalidation.

One URL Does Not Necessarily Mean One Origin Fetch

A single page URL can correspond to multiple cached objects because of query parameters, language, compression format, or custom cache keys. Edge caches in different regions may also become cold independently. An upper-tier cache can absorb misses from multiple edges. If the purge also clears that tier, or requests bypass it, more fetches reach your origin directly.

Request collapsing also changes the impact. Concurrent misses for the same cache key may be served by a single upstream request, or they may generate multiple origin fetches. Verify whether it is enabled, which tiers it covers, and whether it applies to large files and range requests in the actual product and account configuration. “Request collapsing is available” does not mean the entire site fetches from the origin only once.

This leads to a distinction that changes the troubleshooting order: if edge misses increase while requests reaching your origin remain largely unchanged, check upper-tier caching and metric definitions first rather than immediately scaling the origin. If origin requests, queueing, and errors rise together, prioritize limiting new origin fetches.

Purging, Prewarming, and Revalidation Are Different Types of Work

Operation or state

Main purpose

Potential upstream work

Key scheduling considerations

Purge or invalidation

Prevent old objects from being reused in their current state

Subsequent user requests trigger fetches or validation

Scope, propagation progress, and whether old copies are retained

Prewarming

Retrieve resources before users request them

Active downloads, cache population, or triggered processing

Target cache tier, job concurrency, and actual coverage completed

Revalidation

Determine whether an existing object is still valid

Conditional requests that may return 304 or new content

Whether validators work and whether validation is still expensive

Using new URLs directly

Separate old and new versions into different objects

Fetches on first access or during prewarming for the new version

Deployment dependency order and retention period for old versions

A successful prewarming job does not mean that every edge, protocol, and cache variant used by your users has been populated. Conversely, a miss at one edge does not prove that the request reached your origin. Assess job status, actual requests, and origin logs together.

Use a Shared Timeline to Identify the Source of the Load

Align Deployment Actions with Origin Metrics

Do not just compare daily averages from “the day before the purge” and “the day after the purge.” Build a short observation window around the actual operations. Mark when resource uploads finished, the purge was submitted and completed, prewarming started, the entry point switched, and prewarming was paused. Then align those events with CDN origin-fetch metrics, origin web server metrics, and application metrics.

Start with these basic checks:

  1. Export the purge scope and prewarming list. Check whether they include the root directory, wildcard scopes, or the entire domain.

  2. Aggregate origin access logs by path for request counts, response bytes, status codes, and request duration. Identify the objects with the largest increases.

  3. Compare CDN edge requests, origin requests, origin-fetch bytes, and cache status. Use the metric definitions for the current product.

  4. Also inspect origin connection counts, request queues, outbound bandwidth, application workers, database connection pools, and slow queries.

  5. Review timeout and retry settings to determine whether failures are continuing to generate new fetch jobs.

If the platform provides prewarming job identifiers or dedicated log fields, use them to distinguish job traffic from user traffic. Do not assume that all requests with a particular User-Agent or source IP are prewarming requests. Reverse proxies, upper-tier caches, and vendor implementations can change these characteristics.

Different Signals Call for Different Responses

Observations during the same period

Most likely mechanism to investigate first

Minimum verification and next step

Origin-fetch bytes surge, CPU changes little, and outbound bandwidth approaches its limit

Large files or repeated fetches are saturating bandwidth

Aggregate bytes by path and pause large-file prewarming first

Origin requests increase alongside application latency and database waits

Regenerating cached pages is expensive

Separate static and dynamic paths, and prioritize limiting jobs for expensive pages

Edge misses increase while your origin load remains stable

Upper-tier caches are absorbing requests, or metrics cover different tiers

Check tiered-cache logs before adding origin capacity

The same resource is fetched repeatedly and remains difficult to reuse after prewarming

Inconsistent cache keys, uncacheable content, or overriding rules

Compare request parameters, response headers, and effective rules

Requests continue to increase after the error rate rises

Automatic retries or duplicate job submissions

Check retry counts, backoff, and the queue of unfinished jobs

Also check whether successful responses are actually correct. HTTP 200 may contain a maintenance page, error JSON, or old-version content. For critical resources, verify version markers, content hashes, or application fields. Looking only at success rates can mistake “returning incorrect content quickly” for recovery.

Budget Prewarming Instead of Simply Setting a Concurrency Value

The Budget Comes from Spare Capacity, Not Maximum Origin Capacity

The capacity available for prewarming should be calculated by subtracting normal business traffic, necessary background work, and a failure margin from a validated safe capacity. Calculate CPU, bandwidth, database, storage, and connection budgets separately. Whichever resource reaches its limit first determines the actual budget.

For example, suppose an origin can consistently handle 500 comparable origin requests per second within its response-time target. Real user traffic currently uses 300 requests per second, and 100 requests per second are reserved for fluctuations. The maximum request budget available for prewarming is then only 100 requests per second. These are illustrative assumptions, not recommended thresholds for any site. If prewarming objects are more expensive than normal objects, this difference cannot be applied directly.

Bandwidth needs a separate calculation. In another hypothetical case, allowing prewarming to fetch 10 objects per second with an average size of 2 MB requires approximately 20 MB per second for response bodies alone, before accounting for other traffic and protocol overhead. Without that spare outbound capacity at the origin, transfers can still cause congestion even when request counts appear low.

Group dynamic pages by generation cost as well. Detail pages with expensive database queries should not share a single “URLs per second” metric with images read directly from storage. Where necessary, set separate budgets for different categories, using smaller batches and longer observation windows for expensive pages.

Limit Concurrency, Rate, and Queue Size Together

A concurrency limit controls the number of requests in flight. A rate limit controls new requests per unit of time. A queue limit controls accumulated work. With only a concurrency limit, small files that respond quickly can still produce a very high request rate. With only a rate limit, slow requests can continue to occupy all available connections.

Under approximately steady conditions, the number of in-flight requests is roughly the request rate multiplied by the average processing time. When the origin slows down, in-flight requests increase even if the submission rate stays unchanged. Do not ignore queueing because “concurrency is already low,” and do not automatically increase concurrency to catch up when responses slow down.

If the CDN only supports batch URL submission without control over the actual fetch rate, regulate the external submission pace with smaller batches and longer waits between them. Use measured increases at the origin to decide when to submit the next batch. Submission API concurrency and background origin-fetch concurrency are different. API rate limits are not an origin protection mechanism.

Define stop conditions in advance. Examples include origin queues exceeding acceptable business limits, application error rates reaching alert thresholds, sustained waits in the database connection pool, or congestion on the origin’s outbound connection. When a condition is triggered, stop new batches and pause jobs that can be canceled rather than waiting for every job to fail.

Reduce the Object Set Before Purging to Avoid Unnecessary Work

Choose Prewarming Objects Based on Actual Demand

Build the prewarming list from recent access paths, campaign entry points, and release dependencies rather than crawling the entire site. Prioritize scripts, stylesheets, above-the-fold images required by entry pages, and public pages with actual demand. Letting users warm infrequently accessed historical content on demand usually consumes less capacity than prewarming everything.

Consider resource size and origin-fetch cost, not just access counts. A frequently requested small icon may warm naturally with little effort. A large file or expensive page required for the initial view may benefit more from advance preparation. For content delivered in segments, such as video, verify whether prewarming covers the complete file or only part of it. A successful request to the home page does not establish that subsequent segments are ready.

Use cache keys that real user requests can reuse. Do not casually add timestamp parameters to “make sure you get the new version.” If query parameters are part of the cache key, this creates an object that users will never request. If those parameters are ignored, they may not distinguish versions as intended at all.

Confirm That Objects Are Cacheable Before Prewarming Them

Check effective path rules, status-code policies, TTLs, query parameters, Cookie, Authorization, and response headers. In particular, when public and authenticated pages share paths, do not simply ignore all cookies or force shared caching on every response to improve the hit ratio.

As explained in the Cache-Control directive reference, no-cache permits storage but requires validation before reuse, no-store means the response must not be stored, and private restricts storage to private caches. Managed CDNs may also apply overriding rules, so check both origin responses and the platform’s effective configuration.

If requests continue reaching the origin repeatedly after prewarming, first establish that the object is cacheable, cache keys match, and no rule bypasses caching. Only then consider expanding prewarming. Repeatedly prewarming personalized APIs that cannot use shared caching usually just consumes application resources early and may even create data-isolation risks.

Three Deployment Scenarios Require Different Purge and Prewarming Sequences

New Versions Use New URLs: Prepare Dependencies Before Switching the Entry Point

When static assets use content hashes or immutable version directories, old resources generally do not need to be purged. Old and new objects can coexist, avoiding the impact of making the entire old version cold at once. MDN’s cache directive documentation identifies versioned resources combined with immutable as suitable for long-term caching, provided that content at the same URL truly will not change.

Use the following deployment sequence:

  1. Upload all dependencies for the new version. Verify that files exist, content types and permissions are correct, and content is consistent across origins.

  2. Submit small prewarming batches for critical new resources. Observe increases in origin requests, bytes, queueing, and errors.

  3. Validate the new entry point and its dependencies within a limited scope. Confirm version completeness before gradually expanding traffic.

  4. Update the entry HTML or version manifest. Purge only the entry point if it has an old cached copy that must be updated immediately.

  5. Retain old resources until both the rollback window and the period during which old pages may reference them have ended. Do not delete them immediately after the new release goes live.

Prewarming a new script does not make already cached old HTML reference it automatically. The deployment control point is the change in entry-point references; prewarming merely makes new dependencies available earlier. A rollback must also restore a matching entry point and dependency version.

Existing URLs Must Be Replaced: Smaller Purges Make Recovery More Controllable

Overwriting content at the same URL cannot isolate old and new versions through separate cache keys. Before deployment, confirm that every origin eligible to serve requests has been updated. Otherwise, some edges may fetch old files again after the purge, leaving content incorrect even when the job reports completion.

Start by purging a small set of objects or a clearly defined directory. Wait for the relevant status reported by the platform, verify content with actual requests, and then schedule controlled prewarming. Expand the batch only after verification passes. Do not allow purge jobs and old prewarming jobs to overlap without coordination.

Do not mechanically apply “prewarm first, then purge” here. If prewarming retrieves the old object at the existing URL, a subsequent purge may immediately invalidate that work. Use a combined workflow only when the platform explicitly supports a verifiable update mechanism. Otherwise, progressing sequentially according to object state and job completion makes the process easier to assess.

Rolling back at the same URL also requires cache convergence. After restoring the old file at the origin, objects that have already cached the new file still need to be updated within a defined scope. By contrast, rolling back versioned URLs generally does not require overwriting the same resource again.

Incorrect or Sensitive Content Must Be Withdrawn: Correctness Comes First

For files involving unauthorized exposure or mandatory removal, first block further retrieval at the appropriate access-control layer. Then invalidate the required scope and verify direct paths, common parameter variants, and application entry points. Do not use fallback strategies that allow old content to be served merely to stabilize load.

A CDN purge also cannot guarantee removal of copies already stored in browsers, local downloads, or other caches outside your control. Recovery assessments must distinguish between “stopping further delivery” and “withdrawing all historical copies.” The latter usually cannot be achieved through a single cache operation.

Verify with Minimal Requests Instead of Turning Troubleshooting into Another Prewarming Run

Keep the Same HTTPS Request When Comparing the CDN and Origin

The following commands are for a small number of manual checks, not load testing. You need an authorized access path to the origin, and its certificate must match the application domain. Replace the example address with an actual authorized address, and do not include real origin addresses in public support tickets. Both requests use the same URL, GET method, and request headers, without user credentials.

curl --noproxy '*' --connect-timeout 5 --max-time 30 \
  -sS -D - -o /dev/null \
  -H 'Accept-Encoding: identity' \
  -w '\ncode=%{http_code} remote=%{remote_ip} dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} first=%{time_starttransfer} total=%{time_total} bytes=%{size_download}\n' \
  'https://www.example.com/assets/release-a/app.js'

curl --noproxy '*' --connect-timeout 5 --max-time 30 \
  --resolve 'www.example.com:443:203.0.113.10' \
  -sS -D - -o /dev/null \
  -H 'Accept-Encoding: identity' \
  -w '\ncode=%{http_code} remote=%{remote_ip} dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} first=%{time_starttransfer} total=%{time_total} bytes=%{size_download}\n' \
  'https://www.example.com/assets/release-a/app.js'

--resolve preserves the URL’s Host and TLS SNI, avoiding the default site or an incorrect certificate that direct IP access might return. The example explicitly bypasses environment-configured proxies. If production access must use a proxy, record that condition separately rather than treating results from different paths as one comparable set. If the origin accepts only CDN requests, do not open it to the entire internet just to run the test. Verify from a controlled network instead.

First inspect the status code, content length, cache-related headers, and actual connection address, then correlate them with logs. An increasing Age can indicate reuse at a cache tier, but it does not by itself prove that all nodes have been prewarmed. Interpret vendor-specific cache-status headers according to the product documentation as well.

The timing fields are cumulative values, not independent phase durations. For this single request over a new connection, connect - dns approximates TCP connection time, tls - connect approximates the TLS phase, first - tls indicates the wait from handshake completion to the first byte, and total - first indicates body transfer time. The first-byte wait still includes request transmission, network transit, and upstream processing; it is not equivalent to application execution time.

The commands do not automatically follow redirects. If a response is 3xx, confirm the actual destination first, then compare under the same conditions. Do not compare an entry-point redirect with a final file. This example forces identity encoding and verifies only that variant. It does not establish the cache state for browsers using other encodings.

Take a Few Repeated Samples and Use Content Checks to Decide the Next Step

Make a small number of repeated requests from the same network using the same address family, recording differences between the first and subsequent requests. Consecutive requests may warm the current path, so separate the initial cold request from later requests rather than averaging them into a single “prewarming speed.” Record IPv4, IPv6, different carriers, and regions as separate groups as well.

If subsequent CDN requests clearly reduce new entries in origin logs and the content version is correct, proceed to the next small batch. If every request reaches the origin, investigate cache eligibility and cache keys first. If the direct origin comparison request is already queueing, do not expand the workload. A successful probe from one location alone does not establish that all user paths have recovered.

Use CdnChart’s website speed test to supplement external access observations, then compare them with the job timeline. External probes cannot replace account-level job records and origin logs. When summarizing results, retain failure rates, timeout counts, and sample counts. Do not discard timeouts and calculate results only from successful samples, or simply average regional P95 values to produce a supposed overall P95.

Cache Configuration That Reduces the Impact of the Next Purge

Separate Immutable Resources from Mutable Entry Points First

The following partial example is for Nginx static file serving. It applies long-term caching only to a version directory whose files are guaranteed not to be overwritten. The files for that directory must actually exist under the configured static root. The one-year duration in the example is a configuration choice, not a universally recommended value.

location ^~ /assets/release-a/ {
    root /srv/www/public;
    try_files $uri =404;
    add_header Cache-Control "public, max-age=31536000, immutable";
}

Do not apply this configuration to login APIs, files that may be overwritten, or user-specific resources. Nginx’s add_header interacts with configuration inheritance. Before applying it, check whether it affects existing security headers or creates duplicate cache headers. Also confirm that no higher-priority CDN rule overrides it.

Limit changes to an explicitly versioned directory and retain the old configuration. Run nginx -t first, then use your existing process to reload gracefully after the test passes. Minimum verification includes checking response headers and content for existing files, and confirming that missing files return the correct error without being cached long-term. If something is wrong, restore the original configuration and verify again rather than expanding the purge to mask a configuration problem.

Entry HTML can use a shorter shared-cache lifetime based on business tolerance, with browser and shared-cache policies expressed separately. s-maxage and max-age apply to different cache types, but whether they are ultimately honored must still be verified against the CDN configuration. Reducing the TTL does not reliably revoke all old objects already stored. Handle urgent updates through the actual invalidation mechanism.

Validate Stale-Content Fallback and Request Collapsing in Advance

For public content that can tolerate briefly serving old data, evaluate stale-while-revalidate, stale-if-error, or equivalent product features so that updates and failures do not all become synchronous origin fetches. Verify the supported scope, interactions with other directives, and overriding rules in the current product. Do not assume that adding a response header guarantees the behavior will take effect.

These mechanisms generally depend on old objects still being retained. If an operation has already deleted the old copies, enabling a fallback afterward may not restore them. Validate this during deployment design rather than treating it as a guaranteed rescue after a full purge.

Use real high-demand paths to validate tiered caching and request collapsing as well. They can reduce duplicate fetches, but they cannot fix cache keys fragmented by meaningless parameters, personalized content that cannot be shared, or excessive generation costs for an individual origin object. When selecting a service, control over these capabilities is often more important than simply obtaining a larger prewarming quota.

When Load Has Already Surged, Stop New Work Before Rebuilding Cache Warmth

During an incident, expanding prewarming often prolongs recovery. First pause new purge and prewarming submissions. Determine whether existing jobs are still running, whether they can be paused or canceled, and whether cancellation affects only work that has not yet started. Stopping submissions in the console does not mean that all background fetches stop immediately.

Next, preserve the minimum capacity required by real users, rate-limit confirmed job sources, and set limits and backoff for automatic retries. Do not disable the WAF, firewall, or origin authentication to make jobs succeed. Do not indiscriminately reject all origin fetches either, because that also blocks users making their first requests.

If outbound bandwidth is congested first, stop large-file jobs first. If the database and application are queueing, stop expensive page jobs first. Resume only once the origin has clearly measurable spare capacity, starting again with critical dependencies and small batches. Preserve valid objects that are already warm wherever possible. Do not clear everything again merely to “make the state consistent.”

If incorrect content is still spreading, handle the necessary scope according to content-correctness requirements and, where necessary, place affected application entry points into a controlled degraded mode. Clearly distinguish capacity problems from content-security problems: the former can tolerate slower convergence, while the latter cannot permit continued delivery of prohibited content.

Use Configuration Acceptance Checks, Not Just Job Success

A safe purge and prewarming plan should ultimately demonstrate three outcomes: users receive the correct version, sustained new work is not overwhelming the origin, and cache reuse remains stable. Incorporate the following checks into the deployment process:

  • Correct content: Entry points and dependencies use matching versions, with no error pages, missing files, or mixed versions on critical paths.

  • Defined scope: Purges cover only necessary objects, and the prewarming list excludes random parameters, private APIs, and historical resources without demand.

  • Effective budgets: After jobs start, requests, bytes, and application costs remain within spare capacity, and stop conditions actually prevent new work when triggered.

  • Correlated evidence: Job records, actual requests, and origin logs agree. Assessment does not rely on a single hit ratio or success status.

  • Viable rollback: Old resources remain available, entry points can be restored, and same-URL replacements have a plan for bringing caches back into alignment.

  • Sustained stability: The observation window covers job execution and subsequent real traffic, confirming that delayed retries, incorrectly cached content, or synchronized expiration do not cause a second peak.

Purging determines how old content leaves the cache; prewarming determines how new content enters it in advance. Neither is a free background operation. Use versioned URLs for immutable resources, minimize the entry points that must be purged, and proceed in batches within the origin’s spare capacity. This keeps deployment speed within the system’s limits instead of forcing the origin to absorb the consequences of a full cache purge.

  • CDN cache purging
  • CDN prewarming
  • origin load surge after a cache purge
  • prewarming concurrency control
  • CDN origin protection
  • cache purge sequence
  • versioned static assets

Related posts