1

After going through some resources on google, got the idea how Akamai CDN edge servers works but got some questions about internals.

  1. Say I have got static content cached at Akamai CDN(XXX.XX.XXX.XXX say in seattle) for my site xyz.com(YYY.YY.YYY.YYY) . Here at some Akamai interface I will route the call to my origin web server ip and ask Akamai to cache the static content.
  2. Now Whenever I type www.xyz.com in browser(for any resource be it static or dynamic), call will go to DNS server to resolve the IP for domain www.xyz.com .
  3. DNS server will provide the IP address of configured Akamai Edge server(say XXX.XX.XXX.XXX which is hard coded in point 1) . My question is How I will ensure DNS server provide the edge server closest to user ? Will it always provide XXX.XX.XXX.XXX which is Seattle IP irrespective user is trying to access the site from China or India ?
user3198603
  • 129
  • 4
  • https://m.youtube.com/watch%3Fv%3Du0NtUPpebCo&ved=2ahUKEwiHuo62y_bkAhWCbVAKHaxPAd0QjjgwFHoECAQQAQ&usg=AOvVaw0Vnw4oOHWOR8tEprS36z_i i think this will tell you howto? – djdomi Sep 29 '19 at 17:49

3 Answers3

2

It's Akamai DNS 'magic' determining where to send the client to get the request.

As I understand it (after having a discussion with an Akamai network architect at an IP-Peering meeting) Akamai's DNS uses shortest path routing (typically BGP) from the enquiring DNS client to determine where the closest location is and provides that IP Address.

The DNS protocol defines how a client requests an address and howw a server provides it. Just as a web server can provide a different resource according to the client requesting it, a DNS server can be written that can also do the same thing.

Internet Routing typically works on Border Gateway Protocol (BGP) where Autonomous Systems (identified by AS numbers) exchange information about which subnets are controlled by which system. When determining how to route to an IP address routers typically choose the route which passes through the smallest number of Autonomous Systems.

So an Akamai DNS server receving a DNS request for a resource hosted at Akamai has the IP address of the requesting client. This can be looked up in their internal database to determine which of the Akamai servers is 'closest' (in terms of the IP route) to that address and so the client can then return the address of the 'closest' server.

After having this conversation I did some trial lookups from different subnets and what I noticed was the first lookup typically took significantly longer than a 'normal' DNS lookup. Presumably this was because the system was looking up how to route to that address. Subsequent lookups were as fast as usual, presumably because the answer is cached.


Extra information (how DNS works)

When a DNS client requests a name from a DNS server the server will either provide the name if it is authoritative for that domain, or it will look it up on other servers (if it is configured to be recursive) or it will provide a previously cached answer. The global 'root' servers allow DNS servers to locate the DNS servers which are authoritative for any par5tcular domain so they can direct a recursive query.

DNS servers do not contain mappings for all addresses on the Internet - that would be impossible to maintain and people who operate domains need to be able to change their own DNS records.

Normally DNS servers are either authoritative or recursive (not usually both). When looking up the address for a name which has a CNAME record the client then needs to lookup the IP address that the A record pointed to by the CNAME record has. So if you have CNAME records pointing at Akamai edge servers then it will be the Akamai doamin that needs to be queried as the Akamia domain servers are authoritative for that domain.

When the request comes to the Akamai server it can lookup any information it wants to in order to work out what IP Address to return. As they have an extensive peering (BGP connected) network they will work out which edge server is best placed to provide the data based on the shortest route between the edge server and the origin of the DNS query.

If the query is being made by a DNS server doing a recursive lookup then it may cache the answer, but as it would request the result with the same IP Address in the future it would normally get the same answer so this is not a problem. Akamai can set how long the record should be cached for in their response providing the address (although a server may choose not to follow their direction with regard to cache lifetime).

As most clients have addresses resolved for them by a DNS server that's part of the same AS the routing length (number of different AS's involved) is the same for the DNS server looking up the address and the actual client machine that wants the address.

Rob Lambden
  • 260
  • 2
  • 6
  • You said `So an Akamai DNS server receving a DNS request for a resource hosted at Akamai has the IP address of the requesting client. This can be looked up in their internal database to determine which of the Akamai servers is 'closest' (in terms of the IP route) to that address and so the client can then return the address of the 'closest' server.` My question is when I type `www.example.com` , call will first go to any DNS server(not Akamai DNS server) which has some hard coded mapping of Akamai edge server, then call will go to that hard coded Akamai edge server. Isn't it ? – user3198603 Oct 01 '19 at 08:00
  • So how Akamai will play any role at DNS server resolution and look into internal database to determine which of the Akamai servers is 'closest' to user ? – user3198603 Oct 01 '19 at 08:00
  • I will put more explanation into my answer ... – Rob Lambden Oct 01 '19 at 08:02
  • Again you said `When the request comes to the Akamai server it can lookup any information it wants to in order to work out what IP Address to return` My question is again on this part only. Request workflow is `Browser > DNS server > Akamai Server > Akamai Edge Server ` I understand once request comes to first akamai server , it can find the closest edge server. But my question is about first akamai server i.e. how DNS will find which is the closes akamai server(not edge server) in the above request flow chain ? – user3198603 Oct 02 '19 at 14:25
  • The DNS request must be resolved by an **Akamai** DNS Server as the DNS server needs to be authoritative for the domain. The Akamai DNS server can do whatever it wants to to resolve the request. I don't see what you don't understand. – Rob Lambden Oct 02 '19 at 15:10
  • Oh you mean to say that when I type `www.xyz.com` in browser request will go to directly to Akamai DNS server to resolve `xyz` instead to any DNS server ? But how browser will get to know request to Akamai DNS server not to any other DNS server ? – user3198603 Oct 03 '19 at 01:14
  • It's how DNS works. You request www.xyz.com - it needs for a response from a server that is authoritative for xyz.com - if it then provides a CNAME for endpoint.some.domain it then needs a resoponse from a server that is authoritative for some.domain - as you point your resources using a CNAME to Akamai's domain you will utlimately get a response from Akamai's DNS servers. – Rob Lambden Oct 03 '19 at 08:03
  • Thanks I got the answer I was looking for from https://humanwhocodes.com/blog/2011/11/29/how-content-delivery-networks-cdns-work/ . It says `At it’s simplest, the DNS server does a geographic lookup based on the DNS resolver’s IP address and then returns an IP address for an edge server that is physically closest to that area`. So basically DNS server will itself provides the closest Akamai Edge server . – user3198603 Oct 04 '19 at 02:13
  • Thanks for letting me know - of course this is what my answer says so any comments on how to improve my answer would be appreciated to increase the quality of this site. The lookup is based on routing as I outlined, not geographic location, because geographic location cannot be accurately determined (the AS can put addresses anywhere they have equipment) and of course we don't care about the physical distance, we care about the number of hops to get to the data (quickest access and download time). – Rob Lambden Oct 04 '19 at 09:26
1

The only thing you do is set up your DNS records to Akamai's specifications. You only put in the address and CNAME records that they give you. Akamai will handle the task of determining which edge router is closest to any particular user.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • As CNAME(pointing to akamai edge server) entry is done at DNS server , Can you please throw some light how Akamai is(or may be doing) internally mapping which esdge server is closest to user ? Is it done by DNS server(not Akamai) where it see user locationa nd find which Akamai edge server is closest to user ? – user3198603 Oct 01 '19 at 07:52
-2

There is a good paper that describes the process.

Paper Name: "algorithmic Nuggets in content distribution"

Max
  • 1
  • Would be more helpful if you could summarize the process and provide a link to the paper you have mentioned. – kn330 Feb 12 '20 at 09:02