close

Implementing CDN Integration with NS1

Content Delivery Networks (CDNs) are widely used for content acceleration across various industries and scenarios, such as large file downloads, video on demand, and live media streaming. NS1, on the other hand, is a service provider that performs domain resolution using a powerful and flexible policy decision engine. By integrating NS1 with CDN services distributed across different regions, customers can efficiently distribute traffic.

Application Scenarios:

  • Customers need to distribute high-traffic live streaming content. The target audience is global, except for countries in South America.
  • Assuming that certain South American countries do not allow access to the relevant live media for certain reasons and would be redirected to a website displaying a 403 Forbidden message upon attempting to access.
  • Different CDN providers are used to accelerate content delivery. Access from China is evenly distributed between Alibaba Cloud and Tencent Cloud CDN, while regions outside China utilize AWS CloudFront.
  • Using NS1 for live streaming domain resolution.


NS1 Configuration Explanation: In the designed scenario, traffic needs to be routed to different CDNs based on the visitor's geographical location. This requirement can be achieved using NS1's Geofence filter. NS1 matches the visitor's IP address against its extensive database to determine their geographical region and then responds with the appropriate CDN domain resolution based on the policies configured in NS1. Since access from China needs to be evenly distributed across two different CDNs, a Weighted Shuffle is added to the domain resolution for China to serve as a filter.

The configuration process in NS1 is illustrated in the diagram below:

How to Effectively Integrate CDN Applications with NS1?

NS1 Configuration Steps:

     

    1. Add a CNAME domain record in NS1, which visitors will use for access.
             How to Effectively Integrate CDN Applications with NS1?
    1. Include the CNAMEs of CDN edge nodes from different service providers and the domain name used to display the 403 message as answers. Below is a demonstration.
            How to Effectively Integrate CDN Applications with NS1?
    1. Create three response groups and place the corresponding answers under each response group.

          How to Effectively Integrate CDN Applications with NS1?

     
    1. Modify the policy decisions.
          How to Effectively Integrate CDN Applications with NS1?
    1. Add the following filtering sequence to the policy decision chain:

          How to Effectively Integrate CDN Applications with NS1?

     
    1. Allocate to the relevant response group based on the desired region. Include weighted proportions for Chinese responses

         How to Effectively Integrate CDN Applications with NS1?           
     
         How to Effectively Integrate CDN Applications with NS1? 

         How to Effectively Integrate CDN Applications with NS1?
     

    Test Demonstration

    1. Simulate accessing from South America.

          How to Effectively Integrate CDN Applications with NS1?

    First, set up a machine in South America for accessing purposes. When accessing www.higherlive.com from this machine, the domain's response will be the IP address of reject.higherlive.com.

    How to Effectively Integrate CDN Applications with NS1?

    If using a browser to access www.higherlive.com on this machine located in South America, the browser will be redirected to the reject.higherlive.com website and display the default web page message.

    How to Effectively Integrate CDN Applications with NS1?

     
    1. Simulating Access from China:

    How to Effectively Integrate CDN Applications with NS1?

    Set up a machine in China for accessing purposes. On the same machine, perform six visits to the www.higherlive.com domain. It can be observed that three responses are directed to Tencent Cloud CDN nodes (highlighted in yellow), while the remaining three are directed to Alibaba Cloud CDN nodes (highlighted in red), which matches the configuration in NS1.

    How to Effectively Integrate CDN Applications with NS1?

     
    1. Simulating Access from Other Regions:

    How to Effectively Integrate CDN Applications with NS1?

    Set up a machine in Taiwan to access the same domain, www.higherlive.com. It can be observed that each response is directed to AWS Cloudfront CDN nodes.

    How to Effectively Integrate CDN Applications with NS1?

     

    Conclusion

    From this simple demonstration, it can be seen how NS1 can be integrated with different CDN services to effectively distribute access traffic from different regions to the optimal CDN routes. This demonstration only utilized two of NS1's policy decisions. NS1 offers over 20 policy decisions, some of which leverage NS1's advanced intelligence and real-time feedback policies (such as Pulsar RUM). Integration with third-party data sources (such as NS1 API, Datadog, Rackspace, etc.) can be used to achieve more refined and complex domain resolutions for network routing, further improving the visitor experience.


     


    Author

     

     

    Solution Architecture
    覃永德 Barry Chum