大网数据广告活动
服务器运维问答

How Akamai CDN serves the content from closes edge server to user ?a

· 52CE 我爱测

After going through some resources on google, got the idea how Akamai CDN edge servers works but got some questions about internals. Say I have got static content cached at Akamai CDN(XXX.XX.XXX.XXX say in seattle) for my site xy…

问题原文

原帖链接 · user3198603 · CC BY-SA 4.0

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 ?

已采纳解答

原帖链接 · Rob Lambden · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。