AWS Startups Blog
What Startups Should Know Before Choosing a CDN
Thanks to Jarrod Guthrie (Sr. Product Manager, AWS) for his contribution.
Performance of a website or application is one of the key factors today for determining the success of a business, and it’s all the more critical for startups. Users today are busier and less patient, and with every extra second delay in your site’s latency, you could be losing business.
Having worked with many different startups, I know that one of the quickest ways to improve the performance of a website or application is to use a Content Delivery Network (CDN). Although the performance of a website depends on various factors — such as how far away the user is from the server, the types and number of resources the web page contains and backend processing — using a CDN is a quick and easy way to improve the performance of your site. And you can do so without having to apply too much effort into troubleshooting, tweaking, or updating of your application code or architecture.
In this post, I don’t discuss what a CDN is or whether you should use a CDN to improve performance (you probably already know the answer to both). Rather, my goal here is to help you make an informed decision if you do choose to go with a CDN. Because there are many different CDN providers in the market today, choosing the right one based on your business needs is essential.
So how do you choose a CDN?
Understanding Your Website, Users, and Priorities
Before you consider any CDN, you should understand your website, your users and your priorities. You could conduct deep research and analysis to gain this understanding, but in my opinion most startups don’t need to spend a lot of time delving into the details. Instead, you can focus on a few key areas to quickly determine which CDN will be the best fit for your business. In the next sections, I discuss those areas.
Types of Resources Contained Within Your Webpage
A website can consist of static content such as images, .css files, and .js files, or it can be a mix of content that includes both static and dynamically generated content that is user-specific. Understanding what your website consists of is very important for improving its overall performance, because some CDNs are good for optimizing mostly static content delivery, while others are good with optimizing both static and dynamic content delivery.
You can easily improve performance of a (mostly) static website by simply caching the static content and serving it to the users out of cache. However, the equation completely changes if a big part of your site are dynamic, which requires much more than just plain caching, (because you cannot cache dynamic content). If your use case is dynamic, make sure that the CDN you select supports that use case or has the necessary features to boost your site’s performance.
Knowing how much of your website is static vs. dynamic content can help you decide what features you need most from a CDN. At the end of the day, you don’t want to pay a lot of money for features that you don’t need, or choose a provider who doesn’t have features that will actually improve the performance of your website.
Geolocation of Your Users
Knowing where your end users are geographically located can help you understand the geographic distribution of the incoming traffic toyour website. Make sure that the CDN you select has a presence in those countries where most (if not all) of your users are located. For example, if a high percentage of users visit your website from India, then make sure that the CDN you select has a presence in India or a nearby region.
Another key point to consider is future growth. If you expect that your global traffic will increase in the future, it might be wise to choose a global CDN now rather than having to negotiate a new agreement with a global CDN once you start seeing that increased global traffic.
Cost vs. Performance
It is very important to understand how a few milliseconds of latency might affect your user’s experience. If you are running a mission-critical website or application where a few hundred milliseconds makes a big impact to your business, you might want to choose a CDN that has the best possible performance. However, perhaps your website or application is not mission critical, and those few hundred milliseconds are invisible or inconsequential to your users. In that case, you could choose a CDN that costs less and has almost as good a performance against the best performing CDN. Hence, it is very important to prioritize both cost and performance before selecting a CDN.
There are other factors that might influence your decision. For example, you might want to self-provision and manage your content yourself. Or perhaps your developers will need programmatic access to the APIs. After you’ve identified the top priorities for your business, you’ll be ready to choose two or three CDNs for testing and evaluating.
Testing Methodologies
Once you identify a few of the top CDNs that match your needs and priorities, the next step is to test the CDNs and evaluate their performance. There are various ways you can monitor your website or application and test how it is performing via a CDN. However, not all tests represent the real user experience, so it’s important to understand how these tests monitor performance. Let’s look at some of those testing methodologies.
Synthetic Testing
One of the most common ways of monitoring performance is synthetic testing, which is typically used by third-party testing companies. In these tests, synthetic traffic is sent to your website (or application) at specific time intervals from external test agents that are located across the Internet to simulate real-life actions. These synthetic tests are scripted to perform a series of actions to mimic a real user’s behavior, such as steps a user might take to search for a product, view the product, and purchase the product. These tests gather information like response time, availability, error rates, and more, and are useful for identifying problems with the website, monitoring the website’s availability, and spotting performance trends over time.
Many start-ups use such tests before getting into production, and they also use the data to make updates to their application after production. However, keep in mind that these test agents don’t represent real users and their actual behavior.
To elaborate further, there are two types of synthetic testing:
Backbone Testing: In this type of testing, test agents are installed within several key data centers across the globe, and the tests are run from those data centers to the closest CDN server, which sometimes is located within the same datacenter or a nearby datacenter.
Because these test agents are installed within data centers, you should consider the following points:
- The network path chosen by these tests will mostly differ from the ones taken by your actual users.
- Often, a CDN server will be in the same data center or nearby data center where the test agents are installed. In such cases, the latency between the test agents and CDN node will be extremely low and will show very good performance. However, this does not represent the experience of actual users.
- Typically, test agents within the data centers will have much faster connections to the CDN node than real users would, and as a result will show better performance than that of real users.
Last Mile Testing: This type of testing is similar to backbone testing, except that here the test agents are placed within user networks rather than data centers. User networks are the networks managed by local ISPs through which users purchase their Internet service.
For monitoring a website’s performance, last mile testing is a better representation of the actual user performance than backbone testing because it’s more likely to follow the network path similar to the path used by a real user. However, it is still not the best representation of the real users. You should consider the following points:
- The accuracy of these tests depends on the coverage and placement of testing agents within the user networks. Often, these testing agents might not have complete coverage for the networks used by the real users.
- At times, certain CDNs might have a special peering relationship with the ASN (Autonomous System Numbers) that is being tested in a geolocation. This offers an advantage over other CDNs, which won’t be the actual representation of performance for real users.
Real User Monitoring (RUM)
RUM testing collects measurements from real users visiting a website or application. Hence, it is a more accurate representation of performance for real users. RUM uses your actual user traffic to measure download speeds. As a result, it provides accurate measurement data. Additionally, it runs the tests from the actual user devices, so it uses the same network paths that are used by real users.
RUM is the most accurate representation of user performance. However, there are few points that you should consider:
- Because RUM downloads test objects automatically when a user visits the website, you must take care that the user experience is not affected.
- To run RUM testing, you have to insert a code snippet within the web page that your users are visiting, so some kind of code modification is required.
As mentioned earlier, synthetic testing can help to monitor your website’s availability, identify problems, and spot performance trends. But synthetic users are not real users, and the testing can lead to assumptions about your visitors that might be erroneous. If you want to compare the performance of several CDNs, RUM testing provides the most accurate representation of the user experience and your website performance because you can see exactly how real users are experiencing your web site or application.
Conclusion
Using a CDN is a quick and easy way to boost your website’s performance. However, do a bit of homework first, and test the performance using the right methodologies to help you choose the CDN that provides the most value to your business and the best experience for your users.
Remember to consider the following points:
- Static vs. dynamic resources contained within your webpage — define the features you actually need to boost your website’s performance
- Geographical distribution of your users — define the countries where the CDN that you choose should have a presence.
- Prioritization of cost vs. performance — choose a CDN that delivers the most value to your business.
Additionally, keep in mind that even though synthetic testing provides a lot of valuable information about your website, RUM testing provides the most accurate representation of the real user experience and should always be used to evaluate a CDN performance.