Download presentation
Presentation is loading. Please wait.
1
A day in the life: scenario
browser DNS server Comcast network /13 school network /24 web page web server Google’s network /19 Link Layer and LANs
2
A day in the life… connecting to the Internet
DHCP UDP IP Eth Phy DHCP DHCP connecting laptop needs to get its own IP address, addr of first-hop router, addr of DNS server: use DHCP router (runs DHCP) DHCP DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in Ethernet DHCP DHCP UDP IP Eth Phy DHCP Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server Ethernet demuxed to IP demuxed, UDP demuxed to DHCP Link Layer and LANs
3
A day in the life… connecting to the Internet
DHCP DHCP UDP IP Eth Phy DHCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server router (runs DHCP) encapsulation at DHCP server, frame forwarded (switch learning) through LAN, demultiplexing at client DHCP UDP IP Eth Phy DHCP DHCP DHCP client receives DHCP ACK reply DHCP Client now has IP address, knows name & addr of DNS server, IP address of its first-hop router Link Layer and LANs
4
A day in the life… ARP (before DNS, before HTTP)
before sending HTTP request, need IP address of DNS DNS UDP IP Eth Phy DNS router (runs DHCP) ARP ARP query DNS query created, encapsulated in UDP, encapsulated in IP, encapsulated in Eth. To send frame to router, need MAC address of router interface: ARP Eth Phy ARP ARP reply ARP query broadcast, received by router, which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router, so can now send frame containing DNS query Link Layer and LANs
5
A day in the life… using DNS
UDP IP Eth Phy DNS DNS server DNS UDP IP Eth Phy DNS router (runs DHCP) DNS DNS DNS DNS Comcast network /13 IP datagram forwarded from campus network into Comcast network, routed (tables created by RIP, OSPF, IS-IS and/or BGP routing protocols) to DNS server IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router demuxed to DNS server DNS server replies to client with IP address of Link Layer and LANs
6
A day in the life…TCP connection carrying HTTP
IP Eth Phy router (runs DHCP) SYN SYNACK SYN to send HTTP request, client first opens TCP socket to web server TCP IP Eth Phy TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server SYNACK SYN SYNACK web server responds with TCP SYNACK (step 2 in 3-way handshake) web server TCP connection established! Link Layer and LANs
7
Three way handshake Data Link Layer
8
TCP 3-way handshake client state server state LISTEN SYNSENT
SYNbit=1, Seq=x choose init seq num, x send TCP SYN msg SYN RCVD ESTAB SYNbit=1, Seq=y ACKbit=1; ACKnum=x+1 choose init seq num, y send TCP SYNACK msg, acking SYN ACKbit=1, ACKnum=y+1 received SYNACK(x) indicates server is live; send ACK for SYNACK; this segment may contain client-to-server data received ACK(y) indicates client is live ESTAB Transport Layer
9
A day in the life… HTTP request/reply
web page finally (!!!) displayed HTTP HTTP HTTP TCP IP Eth Phy router (runs DHCP) HTTP HTTP HTTP request sent into TCP socket IP datagram containing HTTP request routed to HTTP TCP IP Eth Phy HTTP HTTP web server responds with HTTP reply (containing web page) web server IP datagram containing HTTP reply routed back to client Link Layer and LANs
10
Chapter 2 Application Layer
A note on the use of these Powerpoint slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: Computer Networking: A Top Down Approach If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!) If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright J.F Kurose and K.W. Ross, All Rights Reserved 7th edition Jim Kurose, Keith Ross Pearson/Addison Wesley April 2016 Application Layer
11
Chapter 2: outline 2.1 principles of network applications
2.2 Web and HTTP 2.3 electronic mail SMTP, POP3, IMAP 2.4 DNS 2.5 P2P applications 2.6 video streaming and content distribution networks 2.7 socket programming with UDP and TCP Application Layer
12
Pure P2P architecture no always-on server
arbitrary end systems directly communicate peers are intermittently connected and change IP addresses examples: file distribution (BitTorrent) Streaming (KanKan) VoIP (Skype) Application Layer
13
File distribution: client-server vs P2P
Question: how much time to distribute file (size F) from one server to N peers? peer upload/download capacity is limited resource us: server upload capacity u2 d2 u1 d1 di: peer i download capacity file, size F us server di uN network (with abundant bandwidth) ui dN ui: peer i upload capacity Application Layer
14
File distribution time: client-server
server transmission: must sequentially send (upload) N file copies: time to send one copy: F/us time to send N copies: NF/us F us di network ui client: each client must download file copy dmin = min client download rate min client download time: F/dmin time to distribute F to N clients using client-server approach Dc-s > max{NF/us,,F/dmin} increases linearly in N Application Layer
15
File distribution time: P2P
server transmission: must upload at least one copy time to send one copy: F/us F us di client: each client must download file copy min client download time: F/dmin network ui clients: as aggregate must download NF bits max upload rate (limiting max download rate) is us + Sui time to distribute F to N clients using P2P approach DP2P > max{F/us,,F/dmin,,NF/(us + Sui)} increases linearly in N … … but so does this, as each peer brings service capacity Application Layer
16
Client-server vs. P2P: example
client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us Application Layer
17
P2P file distribution: BitTorrent
file divided into 256Kb chunks peers in torrent send/receive file chunks tracker: tracks peers participating in torrent torrent: group of peers exchanging chunks of a file Alice arrives … … obtains list of peers from tracker … and begins exchanging file chunks with peers in torrent Application Layer
18
P2P file distribution: BitTorrent
peer joining torrent: has no chunks, but will accumulate them over time from other peers registers with tracker to get list of peers, connects to subset of peers (“neighbors”) while downloading, peer uploads chunks to other peers peer may change peers with whom it exchanges chunks churn: peers may come and go once peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent Application Layer
19
BitTorrent: requesting, sending file chunks
requesting chunks: at any given time, different peers have different subsets of file chunks periodically, Alice asks each peer for list of chunks that they have Alice requests missing chunks from peers, rarest first sending chunks: tit-for-tat Alice sends chunks to those four peers currently sending her chunks at highest rate other peers are choked by Alice (do not receive chunks from her) re-evaluate top 4 every10 secs every 30 secs: randomly select another peer, starts sending chunks “optimistically unchoke” this peer newly chosen peer may join top 4 Application Layer
20
BitTorrent: tit-for-tat
(1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers higher upload rate: find better trading partners, get file faster ! Application Layer
21
Overlay Networks And Distributed Hash Tables
Application Layer
22
Distributed Hash Table (DHT)
DHT paradigm Circular DHT and overlay networks Peer churn
23
Simple Database Simple database with(key, value) pairs:
key: human name; value: social security # Key Value John Washington Diana Louise Jones Xiaoming Liu Rakesh Gopal Linda Cohen ……. ……… Lisa Kobayashi key: movie title; value: IP address
24
Hash Table More convenient to store and search on numerical representation of key key = hash(original key) Original Key Key Value John Washington Diana Louise Jones Xiaoming Liu Rakesh Gopal Linda Cohen ……. ……… Lisa Kobayashi
25
Distributed Hash Table (DHT)
Distribute (key, value) pairs over millions of peers pairs are evenly distributed over peers Any peer can query database with a key database returns value for the key To resolve query, small number of messages exchanged among peers Each peer only knows about a small number of other peers Robust to peers coming and going (churn)
26
Assign key-value pairs to peers
rule: assign key-value pair to the peer that has the closest ID. convention: closest is the immediate successor of the key. e.g., ID space {0,1,2,3,…,63} suppose 8 peers: 1,12,13,25,32,40,48,60 If key = 51, then assigned to peer 60 If key = 60, then assigned to peer 60 If key = 61, then assigned to peer 1
27
Circular DHT “overlay network”
each peer only aware of immediate successor and predecessor. 1 12 13 25 32 40 48 60
28
Resolving a query 1 value 12 60 13 48 25 O(N) messages
What is the value associated with key 53 ? 1 value 12 60 13 48 25 O(N) messages on avgerage to resolve query, when there are N peers 40 32
29
Circular DHT with shortcuts
1 12 13 25 32 40 48 60 What is the value for key 53 value each peer keeps track of IP addresses of predecessor, successor, short cuts. reduced from 6 to 3 messages. possible to design shortcuts with O(log N) neighbors, O(log N) messages in query
30
Peer churn handling peer churn: example: peer 5 abruptly leaves
peers may come and go (churn) each peer knows address of its two successors each peer periodically pings its two successors to check aliveness if immediate successor leaves, choose next successor as new immediate successor 1 3 4 5 8 10 12 15 example: peer 5 abruptly leaves
31
Peer churn handling peer churn: example: peer 5 abruptly leaves
peers may come and go (churn) each peer knows address of its two successors each peer periodically pings its two successors to check aliveness if immediate successor leaves, choose next successor as new immediate successor 1 3 15 4 12 10 8 example: peer 5 abruptly leaves peer 4 detects peer 5’s departure; makes 8 its immediate successor 4 asks 8 who its immediate successor is; makes 8’s immediate successor its second successor.
32
Overlay networks Content Distribution Networks
Application Layer
33
Video Streaming and CDNs: context
video traffic: major consumer of Internet bandwidth Netflix, YouTube: 37%, 16% of downstream residential ISP traffic ~1B YouTube users, ~75M Netflix users challenge: scale - how to reach ~1B users? single mega-video server won’t work (why?) challenge: heterogeneity different users have different capabilities (e.g., wired versus mobile; bandwidth rich versus bandwidth poor) solution: distributed, application-level infrastructure Application Layer
34
Multimedia: video video: sequence of images displayed at constant rate
…………………….. spatial coding example: instead of sending N values of same color (all purple), send only two values: color value (purple) and number of repeated values (N) ……………….……. frame i frame i+1 temporal coding example: instead of sending complete frame at i+1, send only differences from frame i video: sequence of images displayed at constant rate e.g., 24 images/sec digital image: array of pixels each pixel represented by bits coding: use redundancy within and between images to decrease # bits used to encode image spatial (within image) temporal (from one image to next) Application Layer
35
Multimedia: video CBR: (constant bit rate): video encoding rate fixed
…………………….. spatial coding example: instead of sending N values of same color (all purple), send only two values: color value (purple) and number of repeated values (N) ……………….……. frame i frame i+1 temporal coding example: instead of sending complete frame at i+1, send only differences from frame i CBR: (constant bit rate): video encoding rate fixed VBR: (variable bit rate): video encoding rate changes as amount of spatial, temporal coding changes Application Layer
36
Streaming stored video:
simple scenario: Internet video server (stored video) client Application Layer
37
Streaming multimedia: DASH
DASH: Dynamic, Adaptive Streaming over HTTP server: divides video file into multiple chunks each chunk stored, encoded at different rates manifest file: provides URLs for different chunks client: periodically measures server-to-client bandwidth consulting manifest, requests one chunk at a time chooses maximum coding rate sustainable given current bandwidth can choose different coding rates at different points in time (depending on available bandwidth at time) Application Layer
38
Streaming multimedia: DASH
DASH: Dynamic, Adaptive Streaming over HTTP “intelligence” at client: client determines when to request chunk (so that buffer starvation, or overflow does not occur) what encoding rate to request (higher quality when more bandwidth available) where to request chunk (can request from URL server that is “close” to client or has high available bandwidth) Application Layer
39
Content distribution networks
challenge: how to stream content (selected from millions of videos) to hundreds of thousands of simultaneous users? option 1: single, large “mega-server” single point of failure point of network congestion long path to distant clients multiple copies of video sent over outgoing link ….quite simply: this solution doesn’t scale Application Layer
40
Content distribution networks
challenge: how to stream content (selected from millions of videos) to hundreds of thousands of simultaneous users? option 2: store/serve multiple copies of videos at multiple geographically distributed sites (CDN) enter deep: push CDN servers deep into many access networks close to users used by Akamai, 1700 locations bring home: smaller number (10’s) of larger clusters in POPs (points of presence) near access networks (but not within so not local network cacing) used by Limelight Application Layer
41
Content Distribution Networks (CDNs)
CDN: stores copies of content at CDN nodes e.g. Netflix stores copies of MadMen subscriber requests content from CDN directed to nearby copy, retrieves content may choose different copy if network path congested … Akamai: 100,000+ servers in clusters in networks in 70+ countries serving trillions of requests a day. How many people use Netflix? manifest file where’s Madmen? Application Layer 41
42
“over the top” Content Distribution Networks (CDNs) …
Internet host-host communication as a service peak load: 7million viewers, 2 Tbytes via OTT challenges: coping with a congested Internet from which CDN node to retrieve content? viewer behavior in presence of congestion? what content to place in which CDN node? 42
43
CDN content access: a closer look
Bob (client) requests video video stored in CDN at 1. Bob gets URL for video from netcinema.com web page 1 2. resolve via Bob’s local DNS 2 5 6. request video from KINGCDN server, streamed via HTTP Bob’s local DNS server netcinema.com 3. netcinema’s DNS returns URL 4&5. Resolve via KingCDN’s authoritative DNS, which returns IP address of KingCDN server with video 4 3 netcinema’s authoratative DNS KingCDN.com KingCDN authoritative DNS Application Layer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.