Significant technology and usage changes have emerged since the initial publication of the practical guide to web resource caching. This updated edition revisits the recommendations issued earlier and brings new focus on:
- Fast Purge, the ability to invalidate or delete assets from the Akamai network in five seconds, and
- API usage, prevalent in native mobile and single page applications.
Akamai Fast Purge allows users to invalidate or delete assets from the edge server caches in five seconds. This can dramatically impact the TTL policy of objects that cannot bear any significant staleness (say more than five or ten min). For these, we used to recommend avoiding invalidation/delete mechanism since the process itself would take more than five minutes.
Now that we can guarantee near-real time purge, the best practice for most cacheable assets is to set a long TTL (e.g. one month) at the edge and trigger Fast Purge OPEN API whenever the content changes.
Upon content change, be it new code deployment or CMS updates, API calls are automatically triggered to invalidate content from Akamai caches in near real-time.
APIs are experiencing a rapid growth due to their widespread usage in mobile native applications and the emergence of micro-service oriented architecture. Because of their relatively small payload size and customized content, API developers often overlook the potential cacheability of this content.
In many cases we witness in the field, a sizeable portion of these API calls can in fact be cached, provided some simple guidelines are followed:
- Optimize cache keys. Often, API calls contain query parameters that may not impact the response. A careful examination of API request patterns allows Akamai to tailor the cache key definitions and maximize cache hit ratios.
- Consider very short TTLs. A TTL of a few seconds can make a Big difference in terms of origin load if a resource is very popular.
And of course, also leverage Fast Purge if appropriate for your API usage patterns.
In light of the above, we can summarize the latest industry best practices for Client and Edge caching in a table: