Lecture 3
Lecture 3
Distributed Networking
Lecture 3– Part 1
company
network
WHAT’S THE INTERNET: “NUTS AND BOLTS” VIEW
protocols control sending,
router
receiving of msgs workstation
e.g., TCP, IP, HTTP, FTP, PPP server
mobile
Internet: “network of networks” local ISP
loosely hierarchical
public Internet versus private
intranet regional ISP
Internet standards
RFC: Request for comments
IETF: Internet Engineering Task
Force
company
network
WHAT’S THE INTERNET: A SERVICE VIEW
communication infrastructure
enables distributed applications:
Web, email, games, e-commerce, file
sharing
communication services provided
to apps:
Connectionless unreliable
connection-oriented reliable
WHAT’S A PROTOCOL?
Hi
TCP connection
req
Hi
TCP connection
Got the response
time? Get http://www.awl.com/kurose-ross
2:00
<file>
time
mesh of interconnected
routers
the fundamental question:
how is data transferred
through net?
circuit switching:
dedicated circuit per call:
telephone net
packet-switching: data
sent thru net in discrete
“chunks”
NETWORK CORE: CIRCUIT SWITCHING
End-end resources reserved for
“call”
link bandwidth, switch
capacity
dedicated resources: no
sharing
circuit-like (guaranteed)
performance
call setup required
NETWORK CORE: CIRCUIT SWITCHING
frequency
time
TDM
frequency
time
NUMERICAL EXAMPLE
How long does it take to send a file of 640,000 bits from host A to
host B over a circuit-switched network?
All links are 1.536 Mbps
Each link uses TDM with 24 slots
500 msec to establish end-to-end circuit
Work it out!
NETWORK CORE: PACKET SWITCHING
resource contention:
each end-end data stream
aggregate resource demand
divided into packets
can exceed amount available
user A, B packets share
congestion: packets queue,
network resources
wait for link use
each packet uses full link
store and forward: packets
bandwidth
move one hop at a time
resources used as needed
Node receives complete packet
before forwarding
1.5 Mb/s
B
queue of packets
waiting for output
link
D E
1 Mb/s link
each user:
100 kb/s when “active”
active 10% of time
N users
circuit-switching: 1 Mbps link
10 users
packet switching:
with 35 users,
probability > 10 active
less than .0004
PACKET SWITCHING VERSUS CIRCUIT SWITCHING
Is packet switching a “slam dunk winner?”
L
R R R
Protocol Layers
PROTOCOL “LAYERS”
a series of steps
LAYERING OF AIRLINE FUNCTIONALITY
airplane routing airplane routing airplane routing airplane routing airplane routing
physical
source
message
segment Ht
M application ENCAPSULATION
M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
Hl Hn Ht M link Hl Hn Ht M
physical
switch
destination Hn Ht M network Hn Ht M
M application Hl Hn Ht M link Hl Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical
APPLICATION ARCHITECTURES
Client-server
Peer-to-peer (P2P)
server:
always-on host
permanent IP address
server farms for scaling
clients:
communicate with server
may be intermittently
client/server connected
may have dynamic IP
addresses
do not communicate directly
with each other
PURE P2P ARCHITECTURE
no always-on server
arbitrary end systems
directly communicate peer-peer
peers are intermittently
connected and change IP
addresses
example: Gnutella
Types of messages
exchanged, Public-domain protocols:
e.g., request, response defined in RFCs
Message syntax: allows for
what fields in messages & interoperability
how fields are delineated
e.g., HTTP, SMTP
Message semantics
Proprietary protocols:
meaning of information in
fields e.g., Skype
Application Underlying
Application layer protocol transport protocol
Object can be HTML file, JPEG image, Java applet, audio file,…
Example URL:
www.someschool.edu/someDept/pic.gif
time
NONPERSISTENT HTTP (CONT.)
request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) Host: www.someschool.edu
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr
Carriage return,
line feed (extra carriage return, line feed)
indicates end
of message
HTTP REQUEST MESSAGE: GENERAL FORMAT
UPLOADING FORM INPUT
Post method:
Web page often includes form
input URL method:
Input is uploaded to server in Uses GET method
entity body Input is uploaded in
URL field of request
line:
www.somesite.com/animalsearch?monkeys&banana
METHOD TYPES
HTTP/1.0 HTTP/1.1
GET GET, POST, HEAD
POST PUT
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
header
Last-Modified: Mon, 22 Jun 1998 …...
lines
Content-Length: 6821
Content-Type: text/html
200 OK
request succeeded, requested object later in this message
301 Moved Permanently
requested object moved, new location specified later in this
message (Location:)
400 Bad Request
request message not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
USER-SERVER STATE: COOKIES
Example:
Many major Web sites use cookies Susan always access Internet
Four components: always from PC
1) cookie header line of HTTP visits specific e-commerce site
response message for first time
2) cookie header line in HTTP
when initial HTTP requests
request message
arrives at site, site creates:
3) cookie file kept on user’s host,
unique ID
managed by user’s browser
entry in backend database for
4) back-end database at Web
ID
site
COOKIES: KEEPING “STATE” (CONT.)
client server
ebay 8734
usual http request msg
Amazon server
cookie file usual http response creates ID
Set-cookie: 1678 1678 for user create
ebay 8734 entry
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
one week later: usual http response msg action backend
database
access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
spectific
usual http response msg action
COOKIES (CONTINUED)
aside
What cookies can bring: Cookies and privacy:
cookies permit sites to
authorization
learn a lot about you
shopping carts
you may supply name
recommendations and e-mail to sites
user session state (Web
e-mail)
How to keep “state”:
protocol endpoints: maintain state
at sender/receiver over multiple
transactions
cookies: http messages carry state
WEB CACHES (PROXY SERVER)
Goal: satisfy client request without involving origin server
institutional
cache
CACHING EXAMPLE (CONT)
origin
possible solution: install servers
cache public
suppose hit rate is 0.4 Internet
consequence
40% requests will be satisfied
almost immediately
1.5 Mbps
60% requests satisfied by access link
origin server
institutional
utilization of access link network
reduced to 60%, resulting in 10 Mbps LAN
negligible delays (say 10
msec)
total avg delay = Internet
delay + access delay + LAN institutional
delay = .6*(2.01) secs + cache
.4*milliseconds < 1.4 secs
CONDITIONAL GET
Goal: don’t send object if cache cache
server
has up-to-date cached version HTTP request msg
cache: specify date of cached If-modified-since: <
object
date>
copy in HTTP request not
If-modified-since: <date>
HTTP response modified
server: response contains no HTTP/1.0
object if cached copy is up-to- 304 Not Modified
date:
HTTP/1.0 304 Not Modified HTTP request msg
If-modified-since: <
date> object
modified
HTTP response
HTTP/1.0 200 OK
<data>