CDN&DNS
DevOps CDN&DNS
CDN(Content Delivery Network) == AWS CloudFront:
- low latency: distributed content to a globally-distributed network of proxy servers/locations local server by caching, such as S3 static resources, which copies content from the original server.
- high availability:
- avoid single point of failure: if one server node failed, all the services will be down.
- avoid DDoS(Distributed Denial of Service) Attack
- The application needs to CDNify via file versioning. Otherwise, it needs time to update (data propagation delay)
so it can reduce bandwidth consumption, secure the original server
DNS(Domain Name System) == AWS Route 53:
The Domain Name System(DNS) is the hierarchical and decentralized naming system used to identify computers reachable through the Internet or other Internet Protocol networks.
(Multi-level queries, ultimately returning the IP address of the target server)
DNS Host: acts like a local phone book. When we access a new domain name, the computer first looks up the corresponding IP address in its own hosts file. If not found, it uses DNS to resolve the domain name to an IP address.
ps: When attempting to connect via HTTP without a certificate, it will throw an error (as shown in figure 4) — only HTTPS is supported.
Common Interview Questions
TLD (Top-Level Domain)
SLD (Secondary-Level Domain)
Classic interview question: What happens after you type a domain name and press Enter?
- The browser checks its own DNS cache.
- If not found, check the local client (local LAN/zone) hosts file for the corresponding IP address.
- If not found, query the DNS server provided by the ISP (root name server) for a cached DNS entry.
- If not found, query the root server recursively (starting from the TLD, e.g. .edu => washington => ... narrowing down step by step until the client obtains the IP address).
- Once the IP address is obtained, make an HTTP/HTTPS request; the client performs a three-way handshake with the server.
- The HTTP request packet contains a header and a body. The header includes metadata about the requested file operation; the body contains the payload/data.
- After the server receives the HTTP request, it performs load balancing and other backend processing.
- Server returns header + response.
- Client (browser) renders the data.
DevOps DNS Record
DNS Record Types
- A: Points a domain name to an IPv4 address (e.g. 11.11.11.11).
- CNAME: Points a domain name to another domain name, producing the same access result as the target domain. The target is usually a domain provided by a hosting provider.
- MX: Mail exchange record — points to a mail server address for email delivery.
- NS: Name server record — specifies which DNS server is responsible for resolving a subdomain.
- TXT: Optional. Typically used for verification purposes or security configurations, such as SPF (anti-spam) records.
- AAAA: Points a hostname (or domain name) to an IPv6 address (e.g. ff03:0:0:0:0:0:0:c1).
- SRV: Service record — specifies which server provides which service. Format: service-name.protocol-type (e.g. _example-server._tcp).
- SOA: Start of Authority record. While NS records identify multiple name servers, the SOA record indicates which one is the primary server.
- PTR: The reverse of an A record — also called an IP reverse lookup record or pointer record. Resolves an IP address back to a domain name.
- Explicit URL redirect: Points a domain to an HTTP(S) address; visitors are automatically redirected and the browser address bar shows the target URL.
- Implicit URL redirect: Points a domain to an HTTP(S) address; visitors are automatically redirected but the browser address bar continues to show the original domain.
Zone: A Zone is a collection of nodes (subdomains) under the main domain. The server maintains a database called a zone file for every zone.
CDN reference: https://cloud.tencent.com/developer/article/1537894
AWS documentation: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html
Route 53 Alias: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html