Search code examples
google-cloud-storagegoogle-cloud-cdn

google cloud CDN always serve my static file through only 1 IP


I have my google bucket connect with a load balancer and CDN enabled in google cloud, but I really don't get how google CDN working for static file, checking in the log viewer i can see the "statusDetails: response_from_cache" and "cacheHit: true" so i can say that the CDN is working properly.

Trying to issue a request for the image in my google CDN bucket from a computer located in Europe, the file return from the frontend IP address of my load balancer. Also the same IP address served my image if i make the request from a computer located in Asia.

So the same IP address was used for serving my static image ignore the location where the request coming from, checking the log viewer again, i can see that both of the request has claimed to go through google CDN, again google log viewer tell me that CDN working properly.

i think that the CDN should serve the file from the nearest server to the end-users, what is the point for using google CDN if the file always served from only 1 single IP address for all user over the world?

I have a free account of cloudflare, once i configure my DNS, the image file go through cloudflare network and if i do the test as above, i will see my static image file returned from multiple IP address which is nearest to my end-users.

Could somebody help me to understand what is the purpose for using google CDN in this case ? did i miss something in the configuration process for google CDN?

Thanks a lot in advance.


Solution

    • Google Cloud CDN uses Google's global edge network to serve content closer to users and it leverages Google Cloud global external HTTP(S) load balancers to provide routing, health checking, and Anycast IP support. The HTTP(S) load balancing configuration specifies the frontend IP addresses and ports on which Cloud CDN receives requests and the backends that originate responses to those requests.
    • Google CDN has a special feature of ‘single anycast IP for the whole network’ letting all contents served through the load balancer frontend IP resulting in low latency. So rather than having one load balancer per region, you can simplify your architecture and have every instance behind a single global load balancer. Also it has a feature of HTTP/2 which supports the latest HTTP protocol for faster performance. For additional information, you can check here.
    • Cloud CDN reduces latency by serving assets directly at Google's network edge. To know more about the caching using Cloud CDN, refer to this caching-overview docs.