Smart UI Load Balancing - Location Based Multi-CDN

Answer from different CDNs for different locations

We have our page copies at four CDNs and we want to return the answer based on user location. And we have some complicated location-based conditions:

  • For visitors from the USA (country) - it will be the page copy usa.myawesomepage.net hosted at Azure CDN.
  • For visitors from Europe (continent) - it will be eu.myawesomepage.net from Akamai CDN.
  • For visitors from Australia and New Zealand (region) - it will be oc.myawesomepage.net from StackPath CDN.
  • For all other visitors (Global) it will be global.myawesomepage.net from Cloudflare CDN.

Important: this is just an example, the pairs 'location-CDN' were taken randomly, this does not reflect the real picture of location-preferred CDNs.


Let’s log into our PerfOps Panel, go to FlexBalancers page create new Smart UI type FlexBalancer (let's call it 'locbasedbalancer'), set fallback to 'backup.myawesomepage.net' and keep the default 10 seconds TTL.

create_3

We have our balancer created, let's add our location-based answers:

answer_1

First, we should create the answer for visitors from the USA (usa.myawesomepage.net, Azure CDN). Fill in the hostname, use ‘Search’ field and select the United States:

answer_2

Then, we select the Azure CDN from the ‘CLOUD PLATFORM’ list and press ‘Create answer’:

answer_3

We press ‘Add new’ button and add the second one (for continent, it will be Europe, eu.myawesomepage.net, Akamai CDN):

answer_5

Then, we add another one for ‘region’ (Australia and New Zealand, oc.myawesomepage.net, StackPath CDN):

answer_7

And finally, the ‘Global’ answer (global.myawesomepage.net, Cloudflare CDN) - that will handle all other cases (when visitor is neither from the USA, nor from Europe, nor from Australia and New Zealand):

answer_8

Now we have four answers and when the request is processed, FlexBalancer will apply sorting rules and check if any country-based answer matches the request location, if not- it will go to region-based answer, if no match - to continent based and if no match - the Global answer will be used:

answer_10

We press ‘Test and publish’ button, confirm the Deployment and press 'Done'. Now we are ready to test our new FlexBalancer. We will emulate the DNS-request via dig-utility, using subnets and IPs from different countries.

Visitor with IP from The USA:

dig_1

Visitor with IP from Europe (France):

dig_2

Visitor with IP from Australia (region):

dig_3

And visitor with IP from Japan should return Global answer:

dig_4

And it does! Everything works as expected.