Lecture 5

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Computer Networks

Chan Yeob Yeun

Lecture 5

OSI vs. TCP/IP

OSI
TCP/IP
MODEL

APPLICATION
7 APPLICATION

Worldwide Web: http


PRESENTATION Remote Login: telnet, rlogin
6 Remote Commands: rexec, rsh
File Transfers: ftp, rcp, tftp, UUCP
E-mail: SMTP, POP3, IMAP
SESSION Remote File Systems: NIS/NFS, RPC
5

TRANSPORT
TRANSPORT
4 Tranmission Control Protocol (TCP)
User Datagram Protocol (UDP)
INTERNETWORKING
NETWORK
3 Internet Protocol (IP)
Internet Control Message Protocol (ICMP)
NETWORK INTERFACE
DATA LINK
&
2
HARDWARE
CONNECTIONS
PHYSICAL
LAN: Ethernet, Token Ring, FDDI, ATM...
1
WAN: SLIP/PPP, X.25, Frame Relay...

P2

1
Chapter 2
Application Layer

A note on the use of these ppt 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. Computer
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Networking: A Top
 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!) Down Approach
 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
Global edition
material. James Kurose, Keith Ross
Thanks and enjoy! JFK/KWR
Pearson
November 2016
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved

Application Layer 2-3

User-server state: cookies


example:
many Web sites use cookies  Susan always access Internet
four components: from PC
1) cookie header line of  visits specific e-commerce
HTTP response site for first time
message  when initial HTTP requests
2) cookie header line in arrives at site, site creates:
next HTTP request  unique ID
message  entry in backend
3) cookie file kept on database for ID
user’s host, managed
by user’s browser
4) back-end database at
Web site
Application Layer 2-4

2
Cookies: keeping “state” (cont.)
client server

ebay 8734
usual http request msg Amazon server
cookie file creates ID
usual http response
1678 for user create backend
ebay 8734
set-cookie: 1678 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action

one week later:


access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
specific
usual http response msg action
Application Layer 2-5

Cookies (continued)
aside
what cookies can be used cookies and privacy:
for:  cookies permit sites to
 authorization learn a lot about you
 shopping carts
 you may supply name and
 recommendations
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

Application Layer 2-6

3
Web caches (proxy server)
goal: satisfy client request without involving origin server
 user sets browser: Web
accesses via cache
 browser sends all HTTP proxy
requests to cache server
 object in cache: cache client
origin
returns object server
 else cache requests
object from origin
server, then returns
object to client
client origin
server

Application Layer 2-7

More about Web caching


 cache acts as both why Web caching?
client and server  reduce response time
 server for original for client request
requesting client
 client to origin server  reduce traffic on an
 typically cache is institution’s access link
installed by ISP  Internet dense with
(university, company, caches: enables “poor”
residential ISP) content providers to
effectively deliver
content (so too does
P2P file sharing)

Application Layer 2-8

4
Caching example:
assumptions:
 avg object size: 100K bits origin
 avg request rate from browsers to servers
origin servers:15/sec public
 avg data rate to browsers: 1.50 Mbps Internet
 RTT from institutional router to any
origin server: 2 sec
 access link rate: 1.54 Mbps 1.54 Mbps
consequences: access link

 LAN utilization: 15% problem! institutional


network
 access link utilization = 99% 1 Gbps LAN
 total delay = Internet delay + access
delay + LAN delay
= 2 sec + minutes + usecs

Application Layer 2-9

Caching example: fatter access link


assumptions:
 avg object size: 100K bits origin
 avg request rate from browsers to servers
origin servers:15/sec public
 avg data rate to browsers: 1.50 Mbps Internet
 RTT from institutional router to any
origin server: 2 sec
 access link rate: 1.54 Mbps
154 Mbps 1.54 Mbps
154 Mbps
consequences: access link

 LAN utilization: 15% institutional


 access link utilization = 99% 9.9% network
1 Gbps LAN
 total delay = Internet delay + access
delay + LAN delay
= 2 sec + minutes + usecs
msecs
Cost: increased access link speed (not cheap!)
Application Layer 2-10

5
Caching example: install local cache
assumptions:
 avg object size: 100K bits origin
 avg request rate from browsers to servers
origin servers:15/sec public
 avg data rate to browsers: 1.50 Mbps Internet
 RTT from institutional router to any
origin server: 2 sec
 access link rate: 1.54 Mbps 1.54 Mbps
consequences: access link

 LAN utilization: 15% institutional


access link utilization = 100% network
 ? 1 Gbps LAN
 total delay = Internet
? delay + access
delay + LAN delay local web
How to compute link
= 2 sec + minutes + usecs cache
utilization, delay?
Cost: web cache (cheap!)
Application Layer 2-11

Caching example: install local cache


Calculating access link
utilization, delay with cache: origin
 suppose cache hit rate is 0.4 servers
 40% requests satisfied at cache, public
Internet
60% requests satisfied at origin
 access link utilization:
 60% of requests use access link
 data rate to browsers over access link 1.54 Mbps
= 0.6*1.50 Mbps = .9 Mbps access link
 utilization = 0.9/1.54 = .58 institutional
 total delay network
1 Gbps LAN
 = 0.6 * (delay from origin servers) +0.4
* (delay when satisfied at cache) local web
 = 0.6 (2.01) + 0.4 (~msecs) cache
 = ~ 1.2 secs
 less than with 154 Mbps link (and
cheaper too!)
Application Layer 2-12

6
Conditional GET
client server
 Goal: don’t send object if
cache has up-to-date
cached version HTTP request msg
object
If-modified-since: <date>
 no object transmission not
delay modified
 lower link utilization HTTP response
before
HTTP/1.0
 cache: specify date of 304 Not Modified <date>
cached copy in HTTP
request
If-modified-since:
<date> HTTP request msg
 server: response contains If-modified-since: <date> object
modified
no object if cached copy after
HTTP response
is up-to-date: HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not <data>
Modified
Application Layer 2-13

Chapter 2: outline
2.1 principles of network 2.6 P2P applications
applications 2.7 socket programming
 app architectures with UDP and TCP
 app requirements
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
 SMTP, POP3, IMAP
2.5 DNS

Application Layer 2-14

7
FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

 transfer file to/from remote host


 client/server model
 client: side that initiates transfer (either to/from remote)
 server: remote host
 ftp: RFC 959
 ftp server: port 21
Application Layer 2-15

FTP: separate control, data connections

 FTP client contacts FTP server TCP control connection,


server port 21
at port 21, using TCP
 client authorized over control TCP data connection,
connection FTP server port 20 FTP
client server
 client browses remote
directory, sends commands
over control connection  server opens another TCP
data connection to transfer
 when server receives file another file
transfer command, server
opens 2nd TCP data  control connection: “out of
connection (for file) to client band”
 after transferring one file,  FTP server maintains
server closes data connection “state”: current directory,
earlier authentication

Application Layer 2-16

8
FTP commands, responses
sample commands: sample return codes
 sent as ASCII text over  status code and phrase (as
control channel in HTTP)
 USER username  331 Username OK,
 PASS password password required
 LIST return list of file in  125 data
current directory connection
already open;
 RETR filename transfer starting
retrieves (gets) file  425 Can’t open
 STOR filename stores data connection
(puts) file onto remote  452 Error writing
host file

Application Layer 2-17

You might also like