Skip to content

CDN Guide » Purge

Last updated: February 20, 2017

Purging is instructing the CDN to no longer serve a file from cache. By doing a purge for /images/logo.png, you instruct the CDN to invalidate that cached image on all edge servers globally. After the purge has completed and a user requests the purged file, the CDN will send a (conditional) request to your origin. Your origin will then respond by sending the newer version of the file which the CDN will cache and serve to users going forward.

Some CDNs don't do invalidation but delete the object from cache. A few CDNs can do both (you choose). See table below.

Tip: unrelated to purge, your origin should always sends objects to the CDN with the Last-Modified (or ETag) header. Without one of these headers, the CDN cannot do conditional requests and will always fetch the complete object from origin to satisfy a user request for an expired object, resulting in slow cache miss responses and unnecessary bytes over the wire. Sending the Last-Modified (or ETag) header speeds up communication between CDN and origin.

Purge type
Is the object invalidated (expires in cache) or deleted (removed from cache)?

Purge time
Many CDNs nowadays do the purge (near) instantly but on some CDNs it may take several minutes.

Purge assurance
When has the purging of objects completed on all CDN POPs? Some CDNs provide a way to know, for every purge request, when the purge was actually completed.

Purge capabilities
Purge per file, purge all files, purge per directory (recursive or not), purge by file type or file extension, purge by tag or key. Do not assume every CDN has all these capabilities.

Purge costs
Some CDNs (eg. Cloudfront) charge for purging if you go over a certain number of purges per month.

CDNs and Purge

  • Available/supported = Yes
  • Partially = Sort of/partially
  • Not available/supported = No
  • Extra costs = Extra costs
  • Unknown = Unknown
CDN Instant Free Type Capabilities Assurance
Limelight More info Available/supported Available/supported Delete or invalidation (user's choice) File, all, directory (recursive/not) Available/supported
Verizon Digital Media Services More info Partially Partially Invalidate File, all, directory (recursive/not), file extension Available/supported
StackPath Available/supported Available/supported Unknown File, all Not available/supported
CDN77 More info Available/supported Partially Delete File, all Partially
Fastly More info Available/supported Partially Delete or Invalidate File, all, directory (recursive/not), tags Not available/supported
CDNetworks Partially Available/supported Delete File, all, directory (recursive/not), file extension Available/supported
Level 3 Unknown Unknown Unknown File, all, directory (recursive/not) Unknown
G-Core Labs More info Partially Available/supported Delete File, all, directory (recursive/not), file type Not available/supported
Incapsula Available/supported Available/supported Delete File, all, directory (recursive/not), file extension Available/supported
Cloudflare More info Available/supported Available/supported Invalidate File, all, header Unknown
CloudFront More info Partially Partially Unknown File, all, directory (recursive/not) Available/supported
CacheFly Available/supported Available/supported Delete File, all Available/supported
Leaseweb More info Available/supported Available/supported Delete File, all Available/supported
ChinaCache More info Partially Available/supported Delete or Invalidation File, all, directory (recursive/not) Available/supported
BelugaCDN More info Available/supported Available/supported Delete File, all, directory (recursive/not) Available/supported
CDNvideo Partially Available/supported Delete File, all Available/supported
Tata Communications More info Available/supported Available/supported Invalidate File, all, directory (recursive/not) Not available/supported
QUANTIL Partially Available/supported Invalidate File, all, directory (recursive/not) Available/supported
SwiftServe Not available/supported Available/supported Invalidate File, all, directory Not available/supported
CDNs missing in this table? That is because we don't have the relevant info

More info per CDN

Fastly

Fastly claims instant purging and from our experience the invalidation/removal of content in cache happens very fast indeed. Their API docs cover all capabilities. To get started you can probably best read the Fastly Help Guide about Purging. Fastly customers may run into the API rate limiting: "You can make up to 1,000 non-read requests per hour."

Limelight

Purging by tag will be supported in an upcoming version of the SmartPurge REST API. There is no limit to the number of purge requests. However, there is a limit of 100 URLs and 100 Patterns per request, and 60 URLs and 60 Patterns per minute per customer account. Purging is free, with additional priority for SmartPurge Plus customers. SmartPurge provides two purge modes: evict, which removes objects from the cache, and invalidate, which triggers a refresh to update the cached content from origin.

G-Core Labs

More info in their How to clear CDN cache? article.

Cloudflare

Cloudflare support articles: How do I purge my cache, How to Purge Cache Using Cache-Tags [Enterprise only].

Verizon Digital Media Services

  • Purging happens pretty fast (10 - 30 seconds) most of the time, but it happens regularly that purging is not complete within 60 seconds. It's handy they provide a way to know when the purge has completed.
  • Verizon Digital Media Services (aka EdgeCast) supports purging by file extension, e.g. /dir/*.css

CloudFront

AWS Documentation: Invalidating Objects (Web Distributions Only).
It usually takes 10 to 15 minutes for CloudFront to complete your invalidation request, depending on the number of invalidation paths that you included in the requestThe first 1,000 invalidation paths that you submit per month are free; you pay for each invalidation path over 1,000 in a month (see CloudFront pricing page).

Leaseweb

Leaseweb Purge API documentation

ChinaCache

Average purge time is 3 minutes.

BelugaCDN

BelugaCDN exposes completion times and information on how many assets were invalidated by the purge request via the API with real-time feedback in the UI. They support full regular expressions on purge request paths. More info in the docs.

Tata Communications

Tata does not accept purge requests containing internationalized characters like è ó ö À. The solution is to encode the path to the file, like so for example with JavaScript: encodeURI("/images/ståle/1.png"). The result will be "/images/st%C3%A5le/1.png" and Tata purging works with this.
From experience, we know purging happens fast across all POPs almost always. However, it is too bad Tata gives no insight into if and when the purge has happened. The good news is that Tata serves responses with the Age header, e.g. Age: 69714. This tells you the number of seconds the object has been in cache. If you see Age: 0 you know TATA just fetched the object from origin. You can easily check the Age header value with curl. The following command GET fetches an object and prints out the response headers:

curl --compressed -vvo /dev/null 'http://cdn.tatacommunications.com/'

CDN77

CDN77 has a limit of 2000 URLs per purge request and limits the number of purge/prefetch requests to 60 per 5 minutes.


More CDN Guides

Comments