17

Cost Management Week: Spend Avoidance

So far, we've looked at cost management through commercial constructs like RIs, or by reducing spend through reducing wastage. However, there is another angle to cost management: efficiency.

By never incurring the cost in the first place - our workloads are naturally more cost effective. While balancing this with the risks introduced by complexity can be tough, worry not - many of the patterns have been honed over decades.

Caching - in any form - is an incredibly low cost way to reduce the compute effort required to serve applications. While most easily implemented in applications like websites, similar patterns can be added across architectures to not only reduce cost - but also improve performance and predictability.

Let's take the sample of a news website. With rapidly changing content, personalisation and customisation (eg. variations for countries, regions, or cities), and a huge backlog - news websites may seem troublesome to cache. It is commonly misunderstood that because of the dynamic nature, it is impossible to cache - resulting in a higher cost of compute.

Thankfully, this isn't the case:

  • Cache for a second. As counterintuitive as it sounds, caching even for one second can result in a significant drop in compute requirements for a platform. If a webserver has to serve 100 requests per second for a single page, and that can be served from a more scalable layer (like a CDN or page cache) - the effective request per second rate drops to 1.
  • Client or Edge Side Include. Instead of assembling the whole page on the server itself - by serving partial page blocks (e.g. an unlogged in homepage) and then overlaying personalisation later, it can significantly reduce the compute cost required. On higher latency networks where multiple requests can be troublesome - this can be handled at the edge (e.g. CDN) to a single request back to the end user.
  • Variant Caching. In our news site example with regional variants - we can utilise a cache key (the 'look up' address for an object) that includes an indicator of a variant - and pass this as part of the request. That allows a single URL (cloudready.foundation/about) to be served with different content depending upon the request, and still hits our goal of customisation.

While these examples may seem specific to our news website - the same principles can be used even within your infrastructure architecture - for instance information used by enterprise applications such as loan lending rates.

Ultimately, managing cost isn't just about optimising spend - but can be from stopping the spend ever happening, at all.