03-Phil and Apps
03-Phil and Apps
• Last time:
• Protocol stacks and layering
15-441: Computer Networking • OSI and TCP/IP models
• Application requirements
1
Aside: "Client-Server" does not Server and Client
mean "Local-Remote"
Server and Client exchange messages over the
Case in point: network through a common Socket API
• X Windows Server Clients
• Basis for Linux Desktops user
Server
ports space
• Runs on local machine (attached
to keyboard, mouse, screen)
• Clients are application programs
• Clients can be remote TCP/UDP TCP/UDP
Socket API kernel
space
• Servers typically:
• are shared IP IP
• manage resources
• are contacted by client Ethernet Adapter Ethernet Adapter hardware
2
Transport Service Requirements Other Requirements
of Common Apps
Application Data loss Bandwidth Time Sensitive • Network reliability
• Network service must always be available
file transfer no loss elastic no
e-mail no loss elastic no
• Security: privacy, denial of service,
web documents no loss elastic no authentication, …
interactive loss-tolerant audio: 5Kb-1Mb yes, 100’s msec
audio/video (often) video:10Kb-5Mb • Scalability.
non-interactve loss-tolerant same as above yes, few secs • Scale to large numbers of users, traffic flows, …
audio/video (sometimes)
interactive games loss-tolerant few Kbps yes, 100’s msec • Manageability: monitoring, control, …
financial apps no loss elastic yes and no: µs?
3
FTP: The File Transfer Protocol Ftp: Separate Control, Data
Connections
Sample Commands: Sample Return Codes • HTTP layered over bidirectional byte stream
• sent as ASCII text over control • status code and phrase • Almost always TCP
channel • 331 Username OK, • Interaction
• USER username password required • Client sends request to server, followed by response from server to
• PASS password • 125 data connection client
• LIST return list of files in
already open; transfer • Requests/responses are encoded in text
starting
current directory • Stateless
• 425 Can’t open data
• RETR filename retrieves • Server maintains no information about past client requests
connection
(gets) file
• 452 Error writing file
• STOR filename stores (puts)
file onto remote host
4
How to Mark End of Message? HTTP Request
5
HTTP Request Example HTTP Response
6
Cookies: Keeping “state” Cookies: Keeping “State”
client Amazon server
Many major Web sites use Cookie file usual http request msg en
server da try
cookies usual http response + creates ID ta in
ba ba
ebay: 8734 se ck
Four components: Example: Set-cookie: 1678 1678 for user en
d
1) Cookie header line in the • Susan accesses Internet
HTTP response message always from same PC Cookie file
2) Cookie header line in HTTP
usual http request msg
• She visits a specific e- amazon: 1678 cookie-
request message cookie: 1678 ess
commerce site for the first ebay: 8734 specific acc
3) Cookie file kept on user’s time usual http response msg
host and managed by user’s
action
ss
• When initial HTTP requests
one week later:
ce
browser arrives at site, site creates a
ac
4) Back-end database at Web unique ID and creates an usual http request msg
Cookie file cookie-
site entry in backend database
cookie: 1678
for ID amazon: 1678 specific
ebay: 8734 usual http response msg action
7
Packet Delay A Word about Units
• Sum of a number of different delay components. • What do “Kilo” and “Mega” mean?
• Propagation delay on each link. • Depends on context
• Proportional to the length of the link
• Transmission delay on each link. • Storage works in powers of two.
• Proportional to the packet size and 1/link speed
• Processing delay on each router.
• 1 Byte = 8 bits
• Depends on the speed of the router • 1 KByte = 1024 Bytes
• Queuing delay on each router. • 1 MByte = 1024 Kbytes
• Depends on the traffic load and queue size
• Networks work in decimal units.
• Network hardware sends bits, not Bytes
D B C B A A • 1 Kbps = 1000 bits per second
• To avoid confusion, use 1 Kbit/second
• Why? Historical: CS versus ECE.
F' 11 Lecture 3: Applications 29 F' 11 Lecture 3: Applications 30
Delay of
one packet Size Throughput
100 Kbit/s 1 Mbit/s 100 Mbit/s
Delay* + Latency
Throughput
Average
500 µsec 1.0005
0.1005 0.1005
0.0105 0.0015
0.0006
sustained
throughput 10 msec 1.01
0.11 0.11
0.02 0.0101
0.011
Units: seconds +
bits/(bits/seconds) 100 msec 1.1
0.2 0.11
0.2 0.1001
0.101
* For minimum sized packet
F' 11 Lecture 3: Applications 31 F' 11 Lecture 3: Applications 32
8
Some Examples Some Examples
• How long does it take to send a 100 Kbit file? • How long does it take to send a 10 Kbit file?
• Assume a perfect world • Assume a perfect world
• And a 100 Kbit file • And a 10 Kbit file
Throughput Throughput
Latency 100 Kbit/s 1 Mbit/s 100 Mbit/s Latency 100 Kbit/s 1 Mbit/s 100 Mbit/s
500 µsec 1.0005 0.1005 0.0015 500 µsec 1.0005
0.1005 0.1005
0.0105 0.0015
0.0006
10 msec 1.01 0.11 0.011 10 msec 1.01
0.11 0.11
0.02 0.0101
0.011
100 msec 1.1 0.2 0.101 100 msec 1.1
0.2 0.11
0.2 0.1001
0.101
• When streaming packets, the network works like • TCP connections need to be set up
a pipeline. • “Three Way Handshake”:
• All links forward different packets in parallel
• Throughput is determined by the slowest stage. Client Server
• Called the bottleneck link
SYN (Synchronize)
• Does not really matter why the link is slow.
• Low link bandwidth
• Many users sharing the link bandwidth SYN/ACK (Synchronize + Acknowledgement)
ACK
50 …Data…
37 30 104 59 17 267
• TCP transfers start slowly and then ramp up the bandwidth
used (so they don’t use too much)
9
HTTP 0.9/1.0 Single Transfer Example
SYN
3 RTT ACK
Client sends HTTP request DAT
for image Server reads from
ACK disk
4 RTT
DAT
Image begins to arrive
• Short transfers are hard on TCP • Mosaic (original popular Web browser) fetched
• Stuck in slow start one object at a time!
• Loss recovery is poor when windows are small • Netscape uses multiple concurrent
• Lots of extra connections connections to improve response time
• Different parts of Web page arrive independently
• Increases server state/processing
• Can grab more of the network bandwidth than other
• Servers also hang on to connection state users
after the connection is closed • Doesn’t necessarily improve response time
• Why must server keep these? • TCP loss recovery ends up being timeout
• Tends to be an order of magnitude greater than dominated because windows are small
# of active connections, why?
F' 11 Lecture 3: Applications 39 F' 11 Lecture 3: Applications 40
10
Persistent Connection Solution Persistent Connection Solution
11
Bandwidth Sharing Fair Sharing of Bandwidth
• Application layer
• Each application needs different services
e.g., data loss? Elastic? Timing?
• FTP
Bottleneck • HTTP
• Interaction with TCP: Persistant? Pipelining?
• Delay/Throughput
12