Content delivery networks and caching
Content Delivery Networks (CDNs)
In order to provide customers with a fast and reliable delivery system, Amplience makes use of Content Delivery Networks (CDNs) to cache content so that it can be delivered to the users faster.
CDNs work by caching identical copies of data throughout a network of servers, known as "edge" servers, situated around the world at geographically significant locations. When a user requests a file, the request first goes to the CDN which will then route the request to the server geographically closest to them. For example, a request from a user in Germany might be routed to an edge server in Frankfurt.
This approach improves response times when delivering content, reduces the likelihood of errors occurring during transfer and helps to ensure that servers do not become overloaded during times of greatest demand. To provide another layer of resilience, the Amplience architecture also includes a mid-tier CDN to cache data and ensure that the web servers containing the original assets, the "origin servers", do not get sent unnecessary requests.
To understand the way that caching works, let's examine the typical lifecycle of an asset:
The asset is uploaded to Content Hub and published. The asset is now available from the Dynamic Media web servers (referred to as the "origin server").
The asset is requested by the end user, by loading a webpage, for example.
The asset is requested from the CDN
The asset is requested from the mid-tier cache
The asset is requested from the origin server.
The asset is cached on the mid-tier cache
The asset is cached on the CDN
The asset is served to the user
The next time the asset is requested, then the asset it will already be in the CDN cache and will be served from the CDN cache to the user.
Time to Live (TTL)
An asset will automatically be cleared from the CDN cache after a specified period known as the TTL (Time to Live). After the TTL has expired, when a request is made for the asset, it will no longer be in the cache and an updated version will be requested from the Amplience servers. By default the TTL is set to 24 hours for the CDN servers and 30 minutes for a browser.
In some circumstances you will want certain assets cached on the Content Delivery Network (CDN) edge servers to be refreshed quicker than the default Time to Live (TTL). There may be an error in an image, an incorrect version of an asset posted, or certain image quality issues, for example. In these cases you can use the "purge" feature included with the Dynamic Media app to clear the asset from the CDN cache so that the next time the asset is requested an updated version will be retrieved. Purging will increase the response time the next time the asset is requested, since it will not be cached on the CDN and will instead be retrieved from the origin servers and then cached.
Purging functionality is provided by the Dynamic Media app. You can purge selected assets one at a time, purging asset variants using the purge path function or purge all assets for an account.
For much more detail about purging see the purging assets page.