DS

Distributed System VI

15640 DS6 - DNS/CDN & Naming

Posted by freeCookie🍪 on December 23, 2017

Distributed System VI

这一篇介绍域名服务器DNS和内容分发网络CDN。因为跑去参加Oath的Hackson所以旷课了没什么印象…

Domain Name System

DNS的工作是将域名和主机名转换为IP地址。

DNS goals:

  • Basically a wide-area distributed database
  • Scalability
  • Decentralized maintenance
  • Robustness
  • Global scope

DNS Recodes: (class, name, value, type, ttl)

DB contains tuples called resource records (RRs)

  • Classes = Internet (IN), Chaosnet (CH), etc.
    • Each class defines value associated with type [A, CNAME, NS, MX]

DNS的层次结构是树形的,每个node存拥有相同后缀的一系列域名。

Zone: contiguous section of name space, an associated set of name servers

Typical Resolution

  • Application calls gethostbyname (RESOLVER)
  • Resolver contacts local name server (S1)
  • S1 queries root server (S2) for (www.cmu.edu)
  • S2 returns NS record for cmu.edu (S3)
    • S3 is what the additional information section is for (PREFETCHING)
  • S1 queries S3 for www.cmu.edu
  • S3 returns A record for www.cmu.edu

Naming

大概是域名的意思,域名和DNS的内容是联合在一起的。利用dig可以查询。反正也不是重点所以失忆感觉实在是太松懈了

Internet Content Delivery

介绍CDN, Content Delivery Networks 内容分发网络。在学习DNS的时候提到,如果有一些域名比较popular怎么办?解决办法就是利用了CDN将它们缓存起来。

DNS based Client Routing

CDN high-level name server chooses appropriate regional POP

  • A-record returned is “best” one for the client
  • Based on server load, location of client
  • Large TTL

CDN low-level name server chooses server in region

  • Should try to chose server that has file in cache
  • This is where consistent hashing comes in
  • Small TTL

这里high level name server是large TTL, low level name server是small TTL。因为client的location不会经常变动,因此cache的内容不会经常变动。而low level存的内容会容易变动,如果某个client崩溃,CDN会快速的设置另一个。

CDN Summary

  • Across wide-area Internet: caching is the only way to improve latency
  • CDNs move data closer to user
  • CDNs maintain consistency
  • CDNs balance load
  • Use consistent hashes and many other DS techniques

参考资料

dig

DNS的解析过程