计算机网络(四)

发布于 作者: Ethan

Content Distribution Networks (CDN) and Domain Name System (DNS)

HTTP Overview

  • Methods (HTTP/1.1): GET, POST, PUT, DELETE, HEAD.
  • Messages:
    • Request: request line, headers, optional body.
    • Response: status line, headers, optional body.
  • Statelessness:
    • Pros: scalability, fault tolerance, independent requests.
    • Cons: some apps require state (e.g., shopping carts).
  • State Handling:
    • Cookies for client-side state (authentication, tracking).
    • Modern alternatives: cohort-based identifiers (e.g., Google FLoC).

Improving HTTP Performance

  • Persistent connections: reuse TCP connections.
  • Parallelism: multiple concurrent requests.
  • Pipelining: multiple requests over one connection.
  • Caching: forward (near clients) vs reverse (near servers).
  • Replication: distribute content across multiple servers.

Content Distribution Networks (CDNs)

  • Combine caching and replication as a service.
  • Benefits:
    • Reduce latency by placing data closer to users.
    • Balance load across servers.
    • Economies of scale.
  • Example – Akamai:
    • Rewrites URLs to point to CDN domains (e.g., a128.g.akamai.net).
    • Requests directed to CDN infrastructure.

DNS Overview

  • Maps human-readable names to IP addresses.
  • Provides indirection: decouples names from addresses.
  • History:
    • Initially flat hosts.txt file (not scalable).
    • DNS introduced in 1983 with hierarchy and distributed servers.

DNS Hierarchy

  • Namespace: hierarchical (.com, .edu, etc.).
  • Administration: delegated zones (e.g., *.umich.edu).
  • Server types:
    • Root servers.
    • Top-Level Domain (TLD) servers.
    • Authoritative servers.

DNS Records

  • A: hostname → IP.
  • NS: domain → authoritative name server.
  • CNAME: alias → canonical name.
  • MX: domain → mail server.

Name Resolution

  • Recursive: server queries on client’s behalf.
  • Iterative: server tells client who to ask next.
  • Local DNS caching with TTL improves performance.

Reliability and Performance

  • Replication of DNS servers for fault tolerance.
  • Caching (positive and negative).
  • Supports load balancing and CDN redirection.

Video Streaming and Cloud Datacenter Applications

Why Video is Special

  • Video files are too large to send in one GET.
  • Users skip forward or change playback quality.
  • Requires adaptive delivery.

Importance

  • Dominates Internet traffic (60% in 2020, projected 82% by 2025).
  • Major sources: YouTube, Netflix.

The Video Medium

  • Sequence of frames (e.g., 30 fps for TV).
  • Very large raw size (MBs per second).
  • Compression essential.
  • Multiple resolutions (480p–4K) for adaptation.

HTTP Streaming

  • Client requests video via GET.
  • Client buffers before playback to reduce interruptions.
  • Issues:
    • Single bitrate → not adaptive to network variability.

DASH (Dynamic Adaptive Streaming over HTTP)

  • Client retrieves a manifest file describing available resolutions.
  • Requests video in chunks.
  • Adapts bitrate based on observed bandwidth.

Cloud Datacenters

  • Backbone of modern web services.
  • Huge scale: millions of servers, billion-dollar costs.
  • Characteristics:
    • Scalability.
    • Fault tolerance with commodity hardware.
    • Multi-tenancy: performance isolation and portability.

Common Applications

  • Partition-Aggregate: hierarchical aggregators combine results.
  • MapReduce: parallel computing paradigm (e.g., Apache Spark).
  • Goal: keep response times <200 ms.

Datacenter Networks

  • Traffic types:
    • North-South: client–server.
    • East-West: server–server (dominant in big data).
  • Traffic characteristics:
    • Many small flows.
    • Large flows contribute most bytes.

Networking Challenges

  • High bandwidth: ideally full bisection bandwidth.
  • Oversubscription: core links often bottlenecked.
  • Better topologies:
    • Clos topology (multi-stage networks).
    • Provides scalability and high bisection bandwidth.

Transport Layer Basics

Purpose of the Transport Layer

  • Provides end-to-end communication between processes.
  • Services include:
    • Multiplexing/demultiplexing (via ports).
    • Optional reliability, ordering, pacing.

Key Protocols

  • UDP: lightweight, only mux/demux, optional checksum.
  • TCP: reliable, ordered byte stream, congestion control.
  • QUIC: modern transport built on UDP, faster connection setup, encrypted packets.

Sockets and Ports

  • Sockets: OS abstraction for communication.
  • Ports: 16-bit identifiers.
    • Well-known (0–1023) and ephemeral ports.
    • Used for mux/demux at the host.

Reliable Transport Challenges

  • Network may corrupt, delay, drop, reorder, or duplicate packets.
  • Solutions require:
    • Checksums.
    • Sequence numbers.
    • Acknowledgements (ACK/NACK).
    • Timers for retransmission.

Protocol Designs

  • Stop-and-Wait:
    • Sender sends one packet at a time.
    • Simple but inefficient (throughput limited by RTT).
  • Sliding Window:
    • Window of packets in flight.
    • Throughput ≈ min(n × DATA/RTT, link bandwidth).
    • Requires cumulative or selective acknowledgements.

Sliding Window Variants

  • Go-Back-N (GBN):
    • Sender retransmits all packets after a lost packet.
    • Receiver discards out-of-order packets.
    • Efficient with low error rates.
  • Selective Repeat (SR):
    • Sender retransmits only lost packets.
    • Receiver buffers out-of-order packets.
    • More efficient but complex.

Observations

  • Large window sizes can fully utilize links.
  • Trade-off between efficiency and complexity:
    • GBN vs SR.
  • All reliable protocols rely on: checksums, timers, ACKs, sequence numbers, sliding windows.