In this blog post, we explain everything you need to know about routing strategies in multi-CDN.
CDNs each have their own routing strategies when it comes to connecting edge nodes to end users. Some use Anycast while others might use DNS records to distribute the traffic between their edge nodes. This alone comes with its own set of challenges but what happens when we want to use multiple CDNs at the same time?
Since Leaseweb provides a multi-CDN service, we’re going to discuss different ways of routing traffic with a multi-CDN solution.
Content Delivery Networks (CDNs) are a set of geographically distributed servers designed to close the gap between the data centers and end users. CDN comes between you and your end users to ensure your users have the best experience possible when visiting your website.
Traditionally, there have been several challenges when it comes to serving web assets efficiently, including:
- High latency
- Limited bandwidth
- Protection against attackers
- Supporting the latest web technologies
CDNs typically operate as isolated private companies, and each has its own network with PoPs (Point of Presence) around the world. They focus on different features or markets depending on their target market, and that is why there’s never a perfect fit for a global customer.
What is Multi-CDN?
Since no CDN can provide the perfect global fit, the solution is to use multiple CDNs. With multi-CDN, you can use multiple CDN providers at the same time and enjoy the unique benefits that they each provide.
In this post, we’ll discuss how Leaseweb routes users to multiple CDNs based on their geolocation with some DSN hackery.
What is DNS?
DNS is the protocol that translates domain names to IP addresses through records. We use DNS to route traffic from end users to real servers. Users would see the same domain name, but we can return different servers in order to distribute the traffic.
Each record includes a few parameters like name, some type of values, ttl (time to live), etc.
One of the most common types of DNS is called “A record”. They directly translate a domain name to an IP address.
Let’s imagine that we have a record with these parameters:
This record means that if we query “sub.domain.com” we would get “188.8.131.52”.
One other important record type is called “CNAME” which basically redirects the query to another domain.
Routing traffic is basically selecting a path for the traffic to get through. In the previous section, we learned how we can use DNS to navigate from domain names to IP addresses that belong to a real server.
In multi-CDN there are multiple routing strategies that we can take to select the best path, therefore, selecting the most optimal CDN. Here are some of the common ones:
- Recursive Resolver Location
- Real-Time Performance Monitoring
Recursive Resolver Location
As we discussed, Recursive resolvers are the ones that talk to us. They usually have tens of PoPs around the world, and the client connects to the one close to them.
We can check the location of the resolver and respond accordingly since the location of the resolver most likely will correlate with the location of the client.
EDNS Client Subnet
As you saw on the diagram above, the client never talks to our authoritative nameserver directly. It instead relies on a recursive resolver like “184.108.40.206” to proxy the request accordingly. That raises a challenge because we need to know where the user is located, in order to send the closest PoP to them.
ECS is an extension that passes the client subnet to an authoritative nameserver. That way, we can have some idea of where the user is located. Not all recursive resolvers support this extension, so this method is used alongside other methods to respond with the most optimal PoP.
Real Time Performance Monitoring
The previous methods relied on passive information to decide the best possible response but in this method, we actively monitor the performance between the client and our network to decide what would be the best result. This is usually done by injecting a script into the web pages so the metrics are used to route the client to the CDN PoP that will have the best possible performance for the user.
By stacking CDN providers with a redundant switching mechanism, our multi-CDN product accelerates content delivery with unmatched reliability and availability at a competitive price. We offer a true multi-CDN product helping businesses with an out-of-box content delivery solution by offloading contract negotiation and administrative tasks, saving you time, money and stress.
Learn more about our multi-CDN solution here.
There is a lot more to discuss related to multi-CDN and DNS, but this post should give you an idea of how things work underneath. We also learned about three common data sources when it comes to DNS decisions.