How to create a Smart UI FlexBalancer

Your first simple location-based balancer

The case: we have our page copy hosted at Akamai CDN as akapage.myawesomepage.net and at Cloudflare CDS as cfpage.myawesomepage.net. What we want to do is to provide Akamai page as answer for all visitors from European continent and Cloudflare page for the rest of the world.

Step one. Go to FlexBalancers page and create new FlexBalancer:

create_1

Let's call it 'mysmart', we select Smart UI type and go to the next step: 

create_2

Let's suppose we have fallback resource 'backup.myawesomepage.net' (page copy or 'Unavailable' page), so we fill it as 'Fallback' and keep the default 10 seconds TTL.

Press 'Create New FlexBalancer' button :

create_3

Now we can see our FlexBalancer mysmart.89f659.flexbalancer.net created.

Step two. Our new balancer has no answers yet, so let's add them (Press 'Add answer' button):

create_4

First, let's set our Cloudflare page as an answer for the whole world. We fill in our cfpage.myawesomepage.net , select (keep) 'Global' location and select Cloudflare CDN from Cloud platform selector, then press 'Create answer' button:

create_5

Our first answer has been added! 

create_6

But we need another answer for Europe, so press 'Add new'. 

We fill in our akapage.myawesomepage.net , select continent 'Europe' and Akamai CDN from Cloud platform selector, then press 'Create answer' button:

create_7 

Now we have FlexBalancer with two answers.

What is important:

sorting_1

Our 'Europe' continent is smaller than 'Global (World), so, when the request is processed, FlexBalancer will check if any continent-based answer matches the request location, if not- it will go Global answer.

Step three. Let’s press ‘Test and publish’ button,

create_8

 confirm the Deployment,

create_9

and get the final window:

create_10

It tells us not to forget to point our page domain name to mysmart.89f659.flexbalancer.net using CNAME record, so requests will go to FlexBalancer and it will manage all answers (Europe to Akamai, other world - to Cloudflare page copies).

Now, let’s test how it works using the dig tool:

We will emulate the DNS-request via dig-utility, using subnets and IPs from different countries:

From France (Europe) we get akapage.myawesomepage.net:

dig_france_1

And from the USA we get cfpage.myawesomepage.net:

dig_usa_1

Let's test it from another computer.

From Denmark (Europe) we get akapage.myawesomepage.net:

image (10)

And from Canada we get cfpage.myawesomepage.net:

image (11)

Everything works as expected!