CDN endpoint having unexpected caching behavior

Rajat Srivastava 40 Reputation points
2023-06-29T10:06:49.5333333+00:00

I was trying out CDN from Microsoft. I have a storage account in central India with a png file. I made a CDN profile and made endpoint for the storage account. The endpoint is working fine but,

1)nslookup for the endpoint don't resolve to an IP, it has cname for traffic manager and that has a cname for front door and so on until it resolves a public IP finally. How does this actually work?

2)The final public IP that I get is from United States, and the data has been cached through that public IP even though I was accessing the resource from India. The behavior remained the same even after deleting the file from the storage account. How is that possible?

The point of CDN is to have lower latency by caching the data in a POP that's closure to the user. Also, I want my traffic to be on Microsoft global network for as long as possible, How would I achieve that in such scenarios?

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,227 questions
Azure Content Delivery Network
{count} votes

2 answers

Sort by: Most helpful
  1. Konstantinos Passadis 19,251 Reputation points MVP
    2023-06-29T10:34:32.78+00:00

    Hello @Rajat Srivastava !

    Welcome to Microsoft QnA!

    Regarding your Questions :

    The Azure CDN infrastructure uses a distributed network of edge servers located around the world. When a user requests a file from your CDN endpoint, their DNS resolver resolves the CNAME record to the CDN endpoint's hostname, and then the request is routed to the nearest edge server based on the user's location. The traffic manager and front door are part of the underlying infrastructure that helps route the request efficiently to the nearest edge server.
    
    The behavior you described might be due to caching. When a file is requested from the CDN endpoint, the edge server first checks if it has a cached copy of the file. If it does, it serves the cached copy directly, resulting in lower latency. The cached copy remains on the edge server until the cache expiration time is reached or the file is evicted from the cache due to space constraints. Even if you delete the file from the storage account, the edge server may continue to serve the cached copy until it expires or is invalidated.
    

    To ensure that your traffic stays on the Microsoft global network and takes advantage of the closest edge servers, you can consider the following:

    **Configure the caching behavior**: You can control caching behavior by setting appropriate cache-control headers for your files. This allows you to specify the cache expiration time and caching rules, ensuring that files are cached for the desired duration.
    
    Use Azure CDN Premium: Azure CDN Premium offers advanced features such as rules engine, real-time stats, and advanced caching options. It provides more control over how your content is cached and delivered, allowing you to optimize performance and control the behavior of the CDN.
    
    **Choose the right CDN endpoint location**: When creating a CDN profile, you can choose the optimal CDN endpoint location that is closest to your target audience. This helps reduce latency and ensures that traffic is served from nearby edge servers.
    

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


  2. GitaraniSharma-MSFT 49,586 Reputation points Microsoft Employee
    2023-07-18T14:48:51.2033333+00:00

    Hello @Rajat Srivastava ,

    Apologies for the delay in response.

    Azure Standard Microsoft CDN uses Anycast IPs, so the POP location IP addresses are the same globally. If you perform a Dig/ping on any Azure CDN endpoint, you can mostly see the same 2 Anycast IP address ranges:

    13.107.246.X

    13.107.213.X

    Anycast is a network addressing and routing methodology in which a single destination IP address is shared by devices (generally servers) in multiple locations.

    Refer the following doc for a generic idea on what Anycast is and how it works: https://learn.microsoft.com/en-us/windows-server/networking/dns/deploy/anycast

    How does Azure CDN find closest location to a client?

    https://learn.microsoft.com/en-us/azure/cdn/cdn-overview#how-it-works

    If you want to find out on which Geo POP edge your request landed, you can make use of the AzureCdnAccessLog.

    The logs can be viewed under your Log Analytics profile by running a query. A sample query would look like: AzureDiagnostics | where Category == "AzureCdnAccessLog"

    The logs will provide various details, out of which you can find the below info as well:

    CacheStatus: For caching scenarios, this field defines the cache hit/miss at the POP.

    ClientIp: The IP address of the client that made the request. If there was an X-Forwarded-For header in the request, then the Client IP is picked from the same.

    POP: Short name of the edge where the request landed.

    Once you find the short name of the POP edge, you can check the same in the below article to find the exact location:

    https://learn.microsoft.com/en-us/azure/cdn/microsoft-pop-abbreviations?toc=%2Fazure%2Ffrontdoor%2FTOC.json

    For more information on Azure CDN logs and how to set them up, please refer: https://learn.microsoft.com/en-us/azure/cdn/monitoring-and-access-log

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.