Caching strategy with focus on full page caching and TTL

Caching strategy is one of the most important design considerations for the enterprise. Lack of comprehensive caching strategy could have adverse effects on Sales , Availability , Customer Experience Credibility and Maintenance costs

cdn

Key drivers when designing the solution include

  • Scalability – Ability to scale the platform to meet increasing demands by offloading a significant portion of processed data to a cache.
  • Peak period – Ability to deal with critical events like Cyber Monday, big campaigns, black Fridays and the likes
  • Customer experience – Ensuring a consistent customer experience across all the channels

 

You can and should cache at different layers like browser, device, web, application, network and database, but the most important layer where one should spend considerable amount of time is content delivery networks CDN when it comes to enterprise scaling. The section below goes into the detail of things to consider while designing CDN.

All other caching aspects should be designed as per the best practices and I am focusing on CDN as that is truly a differentiator for enterprise solution

The basis of CDN such as Akamai, limelight, fastly and the likes is to serve up content to customers from a geographically closer server in their network known as the edge network.

2 key decisions to be made while implementing CDN’s are

page template

  • Full page caching vs fragment based caching. Personally I am a big fan of full page caching. Practically this means the entire page including header, static content, dynamic content and footer comes from the CDN. We need to implement strategies to override the dynamic content. A couple of effective strategies include
  • 1 AJAX – Pull the dynamic content using AJAX queries and override the DOM element of the base html. This can cause some amount of front performance issues. More on front end performance is discussed in a separate section
      • 2 Make use of server side includes – This means that within your base page you give hints to CDN to aggregate dynamic content separately with different timings
  • Time to live TTL – what are the TTL’s to be set for each page type. Like pages which can change frequently i.e. content pages needs lower TTL (like 1 hour) as compared to pages which do not change that often like product detail pages (like 24 hours). Although this pages may be cached for longer duration dynamic elements like price, inventory and the likes will be obtained separately and aggregated as explained above and thus giving accurate information. Things to consider will be
    • How often time base content are published
    • How many times intra day content push is needed
    • How many times promotion and price changes
    • Are there are any flash sales i.e. during a specific TV program get 20% on womenswea

Lastly try and design the process to take control of the site in case Akamai is down like routing all the request to origin. Most likely if you have a CDN then your infrastructure will not be able to deal with the high load if everything comes to origin and this where you need effective peak management capabilities like switching off certain calls to backend which are CPU intensive, disabling certain functionalities, making site decoupled for intensive operations like inventory updates.

Overall to summarize my suggestion, for scaling enterprises for digital emphasis on the right caching strategy specifically CDN’s and within CDN’s focus on full page caching and TTL’s.

Please share your thoughts if you have encountered any strategies which have been helpful for scaling.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s