A Content Delivery Network (CDN) is a collection of distributed nodes, called edge servers, connected to the same origin servers and placed local to the users’ location. If you are using a CDN, your website content is delivered to the user from the nearest edge server to their location. Without a CDN, you are putting stress on the origin server every time a user requests something. If you have many visitors on your website, it would bog down your server making it slower to respond and even worse, become unresponsive to the users.
How a CDN Works
Think of CDN as a tree whose root is your origin server and edge servers are the tree nodes. When new content is made available on the origin server, it is distributed and cached on all edge servers. Now when a user makes a DNS request, it is interrupted by CDN, and the content is served from the nearest edge server. There are two fundamental approaches to implement a CDN cache strategy:
Push Network. When any new content is uploaded to the website, the origin server pushes this new content to the CDN. Then, CDN takes this new content and distributes across all it’s edge servers to cache it there. This is essentially a pre-caching strategy where we minimize a hit-and-miss when the request for a resource is made the very first time on the network. Cached content is available to the user from the edge server for the subsequent requests.
Pull Network. In this strategy, there is no pre-caching. When any resource is requested the very first time, CDN goes to the origin server, fetches the content and serves it to the user. This content is then distributed to all the edge servers and put in the cache on edge servers. In this strategy a hit-and-miss occurs, increasing the first load time.
Which one of the two approaches you use depends on your use case and CDN provider you are using. Type of the content also plays an important role here, but a mixed approach of both push and pull strategy is the best when it comes to fully utilizing the power and benefits of a CDN.
Static and Dynamic Content
Now, not every piece of content on your site is able to be cached, so let’s talk a bit about the types of content before we dive deep into a better pre-caching strategy using synthetic monitoring.
Dynamic content, however, is generated on the server-side in response to the user’s request based on location, device, time, personal settings, etc. At one point dynamic content was not able to be cached, but as technologies evolved, dynamic content too can be cached and served from the edge server.
There is an important point to note here from the perspective of a business. If you don’t pre-cache the data, first-time users are most likely going to face a hit-and-miss, thus increasing the latency and having a slower response. With every second of delay, your website’s bounce rate is increases. 9.6 percent of visitors bounce when page load time is 2 seconds and 32.3 percent of users bounce if it is 7 seconds. Those kind of numbers can result in a significant drop in revenue.
More often, regardless of the content type, CDN has a set expiration to purge the cached content and bring in new content from the origin server. This expiration options can be the following:
- Origin controlled
- TTL (time to live) specification
- Never expire
- Do not cache
If users from certain locations don’t make a request for a particular content and the content is expired, then depending upon your cache expiration strategy, they might also face a hit-and-miss scenario resulting into more bounce rate for your website. With CDN implementation in place, we get three main benefits:
- Performance. Speeding up your website performance by reducing latency and server loads.
- Availability. Making your data more available to counter server failure and low-bandwidth.
- Security. Increasing your overall server capacity utilizing a CDN to dodge DDoS and other network attacks on data.
So, pre-caching your data on edge servers using an efficient CDN strategy will give you all sorts of advantages. But the question is, with interactive websites, dynamic content, and complex user paths, how do you pre-cache the data? The answer is distributed synthetic monitoring.
What About Prefetching? Pre-caching vs. Prefetching Explained
While researching the best ways to monitor pre-cached assets, you may have come across the terms “precaching” (no hyphen) and prefetching. Which raises the question—what is the difference between these terms (if any), and how does that impact your choice of a synthetic monitoring solution?
Simply put—there’s no meaningful difference between these terms. Additionally, no standards organization has defined these terms separately.
However, it’s worth noting that some end users take the term prefetching to be more frequency and time-bound, in that prefetching is used for resources that will be needed immediately, accessed only once, and can be discarded/deleted after using them.
In contrast, many of those same end users believe that the term pre-caching (sometimes spelled “precaching” without a hyphen), is used when describing assets that will be accessed multiple times and also stored for longer periods of time.
Some software and web-based companies define these terms independently as well, based on their own platforms. For example, Google uses the term “precaching” (no hyphen), to refer to the way that asset loading can be controlled in their web application Workbox.
Ultimately, the most important thing to take away is that there’s no meaningful difference between the terms, and they’re typically used interchangeably in the web development community. However, if you’re looking to monitor a specific type of web application, may want to ensure that you understand how these terms are defined or used within that particular framework.
Synthetic monitoring is a mechanism to monitor your websites and applications by simulating users in an interactive environment using tools and scripts. These tools perform traversing of possible guided paths and business transaction activities around-the-clock. By implementing synthetic monitoring for your sites and applications, you get important information about the performance, such as latency, accessibility, broken transactions, etc. There are many third-party SaaS options available but you would want to choose one with a wide array of monitoring solutions. Typically these solutions have click-and-go setup and get you ready in no time.
For example, the web application monitoring solution from Dotcom-Monitor includes a point and click scripting tool called the EveryStep Web Recorder. Simply navigate through your website or application like one of your users would to create scripts that you can use to monitor your web applications.
Pre-caching CDN Edge Serves with Synthetic Monitoring
If you are using a CDN, Synthetic monitoring setup for multiple locations will take advantage of the distributed system to perform synthetic monitoring on every edge server to simulate localized users. Thus, requesting the content before any user does, pre-cache the content, and minimizing the first hit-and-miss and loading time for almost all of your users. As synthetic monitors are set up to perform tests in intervals around the clock, they maximize the chances of detecting new content uploaded before any user could. Thus, pre-caching the content based on location, time, and device and enabling the CDN edge servers to serve the content faster and efficiently.
Advantages to Pre-caching CDN Edge Servers
- Monitoring website uptime across different end-users in multiple locations.
- Pre-caching the content for speeding up the first load time.
- Purging and replacing expired CDN cache to deal with frequent hit-and-miss.
- Monitoring complex business transactions and process flow.
- Detecting server and application failures and implementing a fail-safe.
- Spot and fix issues before they affect end-users.
- Baselining and benchmarking for improvement strategies.
- Analyze UX from the end-user perspective.
If you are using a CDN but haven’t implemented synthetic monitoring, you may want to have synthetic monitoring in place for your application to make the best of the content delivery mechanism and rack in the unconsciously lost revenue.