3 CDN Tricks to Optimize Cloud Costs

Dror Arie Head of Engineering @ GlobalDots
5 Min read

These smart CDN configurations can reduce your overall cloud-related costs. 

The premise of CDNs traditionally stresses user experience, availability, reliability, and scalability. Deploying CDNs to provide better performing applications and websites for the end-user’s benefit usually means added costs to infrastructure spend.

How One AI-Driven Media Platform Cut EBS Costs for AWS ASGs by 48%

How One AI-Driven Media Platform Cut EBS Costs for AWS ASGs by 48%

Our customers already know it could actually be the other way around. 

GlobalDots is today a cloud integrator of multiple competences, from cloud security to a fast-growing FinOps department. But 17 years ago, it actually began from CDN value-added services, helping customers maximize performance and coverage while ensuring competitive pricing. This article peeks into our secret arsenal of tricks, which save our customers some 45% off their overall cost of cloud-based web and mobile application operations.

Cloud & CDN Cost Components

Before we optimize any costs, we must first understand their structure. Cloud-based web delivery infrastructure divides into two main cost categories: CDN costs and cloud costs.

CDN Costs

CDN billing is normally based on outgoing traffic delivered in GBs/TBs/PBs per month. Different rates apply to different levels of product, geographic reach and capabilities, e.g static object caching vs. dynamic traffic acceleration, HTTPS support and more.

Cloud Costs

This is where complexity builds up, but we’ll do our best to simplify things:

  • Cloud Storage: typically billed by GBs/TBs/PBs stored, number of requests, and the amount of data fetched off cloud storage.
  • Cloud Computing: billed in various models such as:
    • reserved instances
    • on-demand
    • savings plans
    • spot instances
    • dedicated hosts.

Each model will determine the way you’ll be billed, but at a high-level you pay for

compute power in seconds / minutes / hours / days, depending on the instance and

service types you choose.

  • Cloud Networking & Data Transfer: when data leaves the cloud provider’s network, or even travels between this cloud provider’s regions, it is being billed for. The rates are per GB/TB/PB delivered, but vary based on the type of service the data originated from.

Assuming the use of both cloud and CDN services, the high-level cost formula would be:

Overall Cost = CDN Cost + Cloud Costs (Storage + Computing + Data Transfer)

Using our CDN expertise, we came up with some configuration techniques that contribute to cloud Cost Optimization. We seek to address  highly complex problems (like deciphering AWS data transfer cost structure) with elegant, cost-effective solutions.

Techniques below divide into 3 main areas: Offload, Network & Data Transfer and Compression Optimizations.

Offload & Caching Optimization

Using CDN services for static object caching like images, videos, Javascript and CSS files, can reduce the load on the application’s origin server. This means less requests hit the cloud storage where static objects reside. While the first layer of CDN caching can increase the cache hit rate or the origin offload rate to 70%-80% (with the caveats of the type of content, application design and content popularity profile), there are more advanced capabilities you can enable to provide higher levels of caching.

Using a 2nd layer of caching, such as parent cache servers (also called tiered distribution), tiered cache, regional edge caches, or shielding, depending on the CDN provider) can improve the cache hit ratio and the origin offload, and by that reduce the cloud Storage and Data Transfer costs of static objects. This feature can increase the cache hit ratio to ~90%.

But to really maximize cache hit ratio, some CDN providers offer a 3rd layer of caching, which practically acts as your origin entry point. With this “cold storage” functionality, you get a dedicated cache layer, and can control on how often the CDN fetches content from your cloud workload.

Depending on the CDN provider, the 2nd or 3rd layers of caching might incur additional costs. However, the overall savings often surpass this added cost, and the overall bill is reduced. By analyzing your web and application ecosystem, our experts assess whether cache layering may improve your position – or recommend alternative measures.

Network & Data Transfer Optimization

Dynamic content is the non-cacheable portion of an application. Examples include:

  • Personalized data, e.g post-login bank account balance
  • Transactional processes, e.g checkout
  • Unique, non-reusable queries, e.g flight or hotel searches

These items must be fetched directly from the cloud workload, time and time again. Here, response time mostly depends on server side / application backend think-time, on which CDN has little to no impact. Therefore, the savings potential of using a CDN for dynamic content is much smaller than it is for static content.

Is it, then, inevitable for cloud costs to soar with traffic?

Now comes the cool part. Given enough traffic volume and geo distribution, expanding CDN usage to the dynamic content may reduce data transfer costs, so you come out ahead at the overall costs level. How come? Well, it’s related to the way CDNs are architected and interact with the cloud workload.

When interacting with cloud workload, each client’s request off the application opens a separate connection, including a separate TCP/TLS handshake process. Now imagine millions of clients constantly interacting with the cloud workload, opening and closing connections throughout the day.

This is where CDN comes in. Each CDN Edge POP (Point of Presence) can aggregate multiple incoming client connections, then push them to the cloud workload in a single request. The CDN-to-workload connections remain open, thus less individual connections are needed to send and receive the same amount of dynamic content. Whereas every connection is billed for, this work method is a massive saver.

Do note that this method is best suited to a very specific traffic profile. Similarly to the Offload Optimization use-case, our team analyzes each application traffic profile to establish whether this move will worth your while. Of course, your profile may enfold entirely new ways to streamline CDN usage and reduce your overall cloud bill. The very thought of it gets us excited. Go figure.

Compression Optimization

Compression methods for images, large files, and text-based files, help us deliver more content while transmitting less bytes. As websites and applications become increasingly engaging and complex, webpages grow ever heavier. On the flip side, the more bytes we need to deliver per page, the slower it gets, and we end up paying more for cloud and CDN resources.

Brotli compression is a more efficient lossless compression algorithm than GZIP and deflate. It can save between 14%-21% bytes over GZIP, depending on file type (Javascript, HTML or CSS), thus improve overall site performance .

Now, not all browsers support Brotli Accept-Encoding/Content-Encoding, so we need some fallback. Once we’ve analyzed which text-based files are frequently requested, we can create 2 file versions – GZIP and Brotli compressed – and cache both in the CDN.

Next, using the CDN layer, we’ll implement a logic that checks whether the client’s browser supports Brotli, then serves the Brotli versions wherever possible.

But first, analyze.

As shown above, investing more in CDN capabilities may sometimes reduce the overall cost of cloud + CDN. Figuring whether this can work for you requires holistic, in-depth analysis by web performance experts.

In GlobalDots, we regularly save customers significant amounts off their cloud-related costs, carefully choosing the relevant, most effective measures per case. It takes years of technical expertise, honest concern, and a healthy portion of creativity.

And the best news? There’s always more to do and discover. Every business is a new treasure map of savings opportunities. Yours too.

Contact us to learn more.

Latest Articles

Cut Big Data Costs by 23%: 7 Key Practices

In this webinar, we reveal a solution that cuts big data costs by 23% and enhances system efficiency - without changing a single line of code. We’ll also explore 7 key practices that will free your engineers to process and analyze data at the pace and scale they need - and ensure they never lose control of the process.

Developer AXE-WEB
15th April, 2024

Unlock Your Cloud Potential

Schedule a call with our experts. Discover new technology and get recommendations to improve your performance.

Unlock Your Cloud Potential