What Edge Settings to Enable to Improve CDN Performance
June 2, 2015 | Marko Markovic
You can listen to an audio version of this blog post as well.
If your website or application is connected to MaxCDN, tweaking Edge Settings based on your unique setup can drastically improve how the CDN behaves.
Edge Settings, accessible through the MaxCDN control panel and API, allow you to modify the behavior of CDN edges in order to: shave precious milliseconds off delivery time, improve your cache-hit ratio, decrease origin load, and enhance the user experience. Edge Settings can also be updated in seconds by ticking (or unticking) a box.
In this article, we will cover Edge Settings in detail. We will also help you determine which settings you should enable or disable to optimize CDN usage.
The best way to kick off an optimization article is with GZIP. This feature significantly improves the performance on most setups by compressing files and reducing their size between 70 and 90 percent.
How It Works
When files are requested, the browser sends specific headers to the server. These headers help the server determine if the browser supports compressed files and which type of compressions are compatible.
Visualization of how GZIP works from the GZIP visual glossary article on MaxCDN One.
An example of a request header would be “Accept-Encoding: gzip, deflate”. This header lets the server know that the browser can decode (extract) compressed files using GZIP and Deflate.
The server – a CDN edge server in this case – compresses the requested files on the fly, using one of the listed compression methods. After this, the compressed files are sent to the browser with the corresponding Encoding header: “Content-Encoding: gzip”.
Formats & Browsers Supported
GZIP compression is intended for text-based files and is not advisable for image formats that are already compressed. In the example of a .jpeg image, GZIP compression is below 1% in most cases. All browsers that support HTTP 1.1+ protocol include GZIP support as well.
GZIP is enabled by default on MaxCDN’s pull and push zones. This means that all files requested from MaxCDN are compressed on our servers if the requesting user agent supports GZIP.
As GZIP only works from server to the requesting point, you can also enable GZIP compression on your server to enhance the transfer towards MaxCDN. More details on how to test if GZIP is enabled and how to apply it on your origin can be found here.
What are Query Strings?
Query strings can be used to update your files without the need to clear the caches. Such methods are also referred to as the cache busting. Query Strings could also be useful for scenarios in which different users are calling the same files with customized values, or entire pages with the content in different languages.
Query String Feature
The feature is enabled by default in the Edge Settings. It forces the files to be cached and served separately if a different query string value is used. If you are utilizing query strings for cache busting or to serve separate files based on query string values, you should keep the feature enabled.
A few month’s ago, our support team found that a high traffic website had query strings on static URLs. After configuring MaxCDN to ignore query strings in the specified zone, the cache hit ratio improved significantly.
Cache Hits (orange) / Misses (red) Vs. Date: Real customer example of query strings being ignored to improve CDN performance. As seen in Improving Your CDN’s Cache Hit Ratio PDF.
The Content Disposition feature adds the “Content-Disposition: attachment” header to your files, forcing all user agents to download the files when they are individually requested.
If you’re using a pull zone to replicate files such as small software patches, PDFs, audio, or video files that should be downloaded immediately upon request, you should enable Content Disposition.
This feature will not block the content from being displayed on web pages, but users will not have the option to preview the content when it’s requested individually.
Strip All Cookies
What are Cookies?
Cookies are widely used on websites that store users’ sessions, shopping carts, and other custom user-based information. By default, MaxCDN stores the same file separately if the cookie value is different.
Strip All Cookies Feature
In case you are not using a full website cache solution, enabling the Strip All Cookies solution will force our servers to ignore the cookie values on your static assets (images, scripts, audio and video files).
The cookies will still be forwarded but they will be stored as any other header value and will not be updated until the file expires or is manually purged.
This feature is mandatory if you are using a service such as CloudFlare as it allows MaxCDN to properly cache the files, which would otherwise always return Cache: MISS as the CloudFlare cookie would be forwarded each time.
Pseudo streaming enables the return of the “206 Partial Content” status code from pull zones, allowing you to manipulate range requests for your files.
If you are caching short audio and video files on a pull zone and have pseudo streaming enabled, you are able to call specified chunks of those files.
For example, the files could be called using the ?time=10s query string which would retrieve the file from that specific moment only. The feature also allows your visitors to seek through the files without having to wait for the file to be buffered, or even cached on the zone.
You can learn more about the pseudo streaming feature here.
If you are using a pull zone to cache your entire application or media gallery – or all of your web pages – it’s a good idea to take advantage of the Use Stale feature.
Use Stale ensures that the cached content requested from the CDN is served when the origin server is unreachable due to network problems, or when the origin is completely offline.
MaxCDN Use Stale: Sometimes serving stale bread is better than serving no bread at all #edgesettings
Even if the files expire from the cache, they will not be deleted until another version of the file can be pulled from the origin. This allows you to secure uptime when your server is undergoing changes or you’re experiencing issues with it.
Ignore Cache Control
What are Cache Headers?
Caching is usually customized for individual scenarios. The aim is always to achieve optimal results while only requiring the lowest possible amount of workflow changes.
Cache control headers define how long the files can be cached on various caching systems such as server caches, browsers, or CDN and reverse proxy servers. Common cache control headers include:
max-age=3000 (value is in seconds)
no-transform (forces the caching system to preserve the file format)
must-revalidate (forces the browsers to revalidate the files before providing them from cache)
Requests for files with any of the “Disallow Caching” headers are sent to the origin server each time, resulting in slower delivery speed and sub-optimal performance. With the “Ignore Cache-Control” feature, you can completely strip all cache control headers and use MaxCDN’s cache settings to apply new ones.
These new headers would separately apply to the MaxCDN servers (Set Default Cache Time) or your visitor’s browsers (Override Cache Control Headers).
Cache Settings section in MaxCDN control panel. Cache settings can also be updated using the pull and push zone API parameters.
If you decide to manage caching behavior via MaxCDN’s interface, this article explains how to leverage browser caching.
MaxCDN’s pull zones act as a reverse proxy between users and origin servers. However, the origin server receives the information from the CDN data center rather than from the user that generated the request.
This may cause problems for websites that return content based on user location.
If you are using a full website caching solution, creating reports on your origin, or even filtering traffic based on visitor’s IP addresses, you should enable the XFF feature in Edge Settings.
This feature will create a header containing the visitor’s IP address that can be used for traffic filtering or reporting.