Most digital publishers use a Content Delivery Network (CDN) as part of a delivery strategy, and for good reason. Traditional benefits range from faster and secure delivery to tight integration with modern publishing systems to subscriber authentication. However, CDNs offer a number of lesser-known benefits that can help digital publishers scale and improve their businesses in surprising ways. Let’s explore five of the ways digital publishers can get more out of their CDNs.
1. Next-level caching
CDNs typically cache fairly simple elements: images, JavaScript, CSS, etc. All of which lend themselves well to caching as they don’t change much – if at all. However, a lot of content is much more cashable than you might think: HTML pages, API routes, GraphQL queries – objects typically referred to as being event-driven. Think about episode- and show listings, user preferences, video manifests, and API responses: these all stay the same until something changes.
A good rule of thumb is that you can probably cash it if it’s querying a database or some sort of abstraction layer, like an API. Most modern CDNs allow you to purge content off the network fairly quickly. In other words, instead of assigning a time-to-live (TTL) of 30 minutes and then going back and repeatedly re-validating, which will tie up resources at your origin, you can cache it “forever” or until you let it expire.
Caching more will help drive down costs, particularly for compute-heavy workloads, such as database queries. This is because you’re caching data at the edge rather than at the origin.
This strategy will give consistent and global performance improvements. Modern CDNs can even help with truly dynamic or completely uncachable stuff. Using a CDN can move TLS connections closer to the end-user so that connections start much quicker. It can keep TCP connections to your origin open and hot, eliminating resources spent on setting them up and tearing them down.
2. Optimization of content
Much of what you’re optimizing at your origin or the application layer can probably be optimized at the network edge. For instance, optimized images will reduce your storage and compute cost. The benefits are many, however, one of the most obvious is updating and refreshing the UI without having to re-process every image. Also, you can instantly take advantage of new file formats, such as WebP or AVI, without large engineering efforts of having to retool your application.
Compressing HTML, CSS, and JavaScript files allows you to save compute cycles and engineering resources by letting your CDN handle the packing and unpacking. Further, it allows you to take advantage of new compression algorithms such as Brotli as soon as they come out. All it takes is a bit of code at the edge.
3. Comprehensive security
CDNs are a great place to implement and enforce security. They are massive in size and designed to take incredible traffic spikes, both legitimate – e.g., large crowds of viewers at live sports events – and malicious DDoS attacks. CDNs are great at hiding where your true origin or application actually lives, helping reduce the attack area for hackers. You can set up IP restrictions, and private network interconnects to restrict access.
Protecting against user behavior and emerging threats requires a nuanced approach – and the WAF offering of most CDNs can help with this. In fact, CDNs are a great place to do all things security. For example, dropping everything that’s not layer seven non-HTTP or non-HTTPS traffic at the edge gives you substantial protection right out of the box.
Your CDN can inspect, detect, and block attacks before they reach your application. Features such as rate-limiting allow legitimate users to enjoy your app while attackers are getting cut off at the edge. Enforcing security policies at the edge saves time, increases performance, and reduces the load on your core applications.
4. Edge computing
Although they vary and run differently, many CDNs have edge compute capabilities today. Some are WebAssembly, some are Docker, and yet some are other forms of virtual sandboxes. They’ve got different feature sets, cost models, and languages they support. Because of its flexibility to execute a multitude of functions, edge computing becomes a great place to build and scale your microservices.
With this in mind, you should push your authentication out to the edge, close to the user, away from the application. You can customize or have featured content based on geography, device type, or other characterization. You can even personalize the experience of every single user at the edge and perform experiments such as complex A/B testing. And when you’ve got new tech such as WebAssembly running on the edge, you can run all of these in a secure performant sandbox environment. This allows engineers to build applications in the languages they prefer, whether JavaScript, Golang, Rust, or any language that enables better developer productivity, better products, and job satisfaction!
5. Visibility
Lastly, let’s talk about visibility. Your CDN inherently handles tons of data. Logs and statistics can help improve day-to-day operations, particularly if they’re available in real-time. (You should expect real-time, as it’s the only way you can see and react to global incidents or localized issues.) You can analyze historical data to make better architectural decisions for future build-outs and improvements. When running experiments, you can use the log data to see if your outcomes were correct or if you should take a different path.
CDN logs can also help reduce costs by identifying areas where your caching or optimization strategies are subpar. They can help you detect new and effective ways that people are trying to misuse and abuse your applications so that you can make informed decisions. And real-time logs help remediate outages, saving you money and reputation from costly downtime.
As we wrap up, we find it a prudent reminder that CDNs have dedicated teams of network engineers, automated tools, and redundant networks. Savvy digital publishers will look beyond the basic functions of these often overlooked tools, and make them work harder to provide better (and safer) user experience, prevent costly outages and downtime, and ultimately improve the bottom-line.