0% found this document useful (0 votes)
4 views19 pages

3 Application Layer (HTTP, Web Proxy)

The document discusses the application layer of computer networking, focusing on protocols like SMTP for email, HTTP for web communication, and DNS. It outlines the client-server and peer-to-peer models of interaction, detailing how messages are exchanged and the structure of mail and HTTP requests and responses. Additionally, it covers performance improvements through persistent connections and caching strategies to enhance network efficiency.

Uploaded by

Jake C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views19 pages

3 Application Layer (HTTP, Web Proxy)

The document discusses the application layer of computer networking, focusing on protocols like SMTP for email, HTTP for web communication, and DNS. It outlines the client-server and peer-to-peer models of interaction, detailing how messages are exchanged and the structure of mail and HTTP requests and responses. Additionally, it covers performance improvements through persistent connections and caching strategies to enhance network efficiency.

Uploaded by

Jake C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Computer Networking and Applications

Application Layer
• Application layer protocols define
– what messages are exchanged
Reading:
– the syntax of the messages Kurose & Ross: Ch 2
– the semantics of the messages
– how/when to exchange messages
– note the interaction is defined, not the application itself!
• We will examine three network applications and their protocols
– E-mail (SMTP – simple transport protocol) (Read up in the text
book)
– the Web (HTTP - HyperText Transfer Protocol)
– Domain Name Service (DNS)
– P2P file sharing
• But first we’ll look at current application architectures...
Computer Networking and Applications

PC running
Firefox browser

Appache
Web Server

iphone running
Safari browser
[email protected]

Computer Networking and Applications


Models of Interaction
• Client - Server
– central storage of information in always on
server
– distinction between client which receives
service and server which provides service
– note that it is possible for a host to act as client/server
both a client and as a server in different
interactions.
– Web, e-mail, FTP
• Peer to Peer peer-peer
– distributed storage of information
– no clear distinction between clients and
servers. Hosts share typically equal control
of processing and data
– Peers dynamically join and leave
– Bit Torrent
Computer Networking and Applications

Electronic mail outgoing


message queue
Three major components: user mailbox
user
• user agents agent
• mail servers
mail user
• simple mail transfer protocol: server agent
SMTP SMTP mail user
server agent
User Agent SMTP
• a.k.a. “mail reader”
SMTP user
• composing, editing, reading mail
agent
mail messages server
user
• e.g., Outlook, Thunderbird, agent
iPhone mail client user
• outgoing, incoming messages agent

stored on server
Computer Networking and Applications
Electronic mail: mail servers
mail servers:
user
• mailbox contains incoming agent
messages for user mail user
• message queue of outgoing (to server agent
be sent) mail messages SMTP mail user
• SMTP protocol between mail server agent

servers to send email SMTP


messages SMTP user
agent
– client: sending mail server mail
server
– “server”: receiving mail user
agent
server. TCP port 25
user
agent
Computer Networking and Applications

Mail message format


SMTP: protocol for exchanging
email msgs header
blank
RFC 822: standard for text line
message format:
• header lines, e.g., body
– To:
– From:
– Subject:
different from SMTP MAIL
FROM, RCPT TO:
commands!
• Body: the “message”
– ASCII characters only
Computer Networking and Applications
Sample smtp interaction
S: 220 hamburger.edu h
C: HELO crepes.fr a
S: 250 Hello crepes.fr, pleased to meet you n
d
C: MAIL FROM: <[email protected]> s
S: 250 [email protected]... Sender ok h
a
C: RCPT TO: <[email protected]> k
S: 250 [email protected] ... Recipient ok i
C: DATA n
g
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup? m
C: How about pickles? e
s
C: . g
S: 250 Message accepted for delivery c
C: QUIT l
S: 221 hamburger.edu closing connection o
s
e
Computer Networking and Applications
Mail access protocols
user
mail access user
SMTP SMTP protocol
agent agent
(e.g., POP,
IMAP)

sender’s mail receiver’s mail


server server

• SMTP: delivery/storage to receiver’s server


• mail access protocol: retrieval from server
– POP: Post Office Protocol [RFC 1939]: authorization,
download
– IMAP: Internet Mail Access Protocol [RFC 1730]: more
features, including manipulation of stored msgs on server
– HTTP: gmail, Hotmail, Yahoo! Mail, etc.
Computer Networking and Applications
The World Wide Web
HTTP 1.0 - RFC 1945
• Client-Server HTTP 1.1 - RFC 2616

• requests
– GET (get a URL)
– HEAD (meta data) PC running
– POST (send data to server) Firefox browser

– PUT, OPTIONS,DELETE,TRACE,CONNECT
• responses
– "nnn message <data>"
– 1xx Informational
– 2xx Success
– 3xx Redirection iphone running
Safari browser
– 4xx Client Error
– 5xx Server Error
Computer Networking and Applications
HTTP request format
GET /somedir/page.html HTTP/1.0 request line (GET, etc commands)
User-agent: Mozilla/4.0
header
Accept: text/html, image/gif,image/jpeg
lines
Accept-language:fr
Carriage return, line feed
(extra carriage return, line feed) indicates end of message

©Kurose & Ross 2001


Computer Networking and Applications

status line
HTTP response format
HTTP/1.0 200 OK
(protocol Date: Thu, 06 Aug 1998 12:00:15 GMT
status code Server: Apache/1.3.0 (Unix)
status phrase) header Last-Modified: Mon, 22 Jun 1998 …...
lines Content-Length: 6821
data, e.g., Content-Type: text/html
requested
html file data data data data data ...

version sp status code sp phrase cr lf


header field name : value cr lf
...

header field name : value cr lf


cr lf
Entity Body
Computer Networking and Applications
Trying out network applications (client side) for yourself

1. Telnet to your favorite server (web server in this example):

telnet www.cs.adelaide.edu.au 80 Opens TCP connection to port 80


(default HTTP server port) at
www.cs.adelaide.edu.au
Anything typed in sent
to port 80 at www.cs.adelaide.edu.au
2. Type in the protocol request (a GET HTTP request):

GET /index.html HTTP/1.1 By typing this in (hit carriage


Host: www.cs.adelaide.edu.au return twice), you send
this minimal (but complete)
GET request to HTTP server

3. Look at response message sent by server!

You can do the same with a mail server on port 25.


Computer Networking and Applications
Improving performance - Persistent HTTP

Persistent without pipelining:


Nonpersistent HTTP issues: • client issues new request only
• HTTP/1.0 when previous response has been
• requires 2 RTTs per object received
• OS overhead for each TCP • one RTT for each referenced
connection object
• browsers often open parallel TCP
Persistent with pipelining:
connections to fetch referenced
objects • default in HTTP/1.1
Persistent HTTP • Often not turned on in browsers
• server leaves connection open after • client sends requests as soon as it
sending response encounters a referenced object
• subsequent HTTP messages • as little as one RTT for all the
between same client/server sent referenced objects
over open connection
Computer Networking and Applications
SMTP: final words

• SMTP uses persistent comparison with HTTP:


connections
• HTTP: pull
• SMTP requires message
• SMTP: push
(header & body) to be in 7-
bit ASCII • both have ASCII
• SMTP server uses command/response
CRLF.CRLF to determine interaction, status codes
end of message
• HTTP: each object
encapsulated in its own
response msg
• SMTP: multiple objects sent
in multipart msg
Computer Networking and Applications
Web caches (proxy server)
Goal: satisfy client request without involving origin server
• user sets browser: Web
accesses via cache proxy
• browser sends all HTTP server
requests to cache client
origin
– object in cache: cache server
returns object
– else cache requests
object from origin server,
then returns object to
client client origin
• Cache acts as both client Why Web caching? server
and server • Reduce response time for client request.
• Typically cache is • Reduce traffic on an institution’s access link.
installed by ISP • Internet dense with caches: enables “poor”
(university, company, content providers to effectively deliver
content (but so does P2P file sharing)
residential ISP)
Computer Networking and Applications

Caching example:
assumptions:
 avg object size: 1Mbit
 avg request rate from browsers to origin origin
servers:15/sec servers
public
 avg data rate to browsers: 15 Internet
Mbps
 RTT from the Internet side of the access link
to an origin server: 2 seconds
 access link rate: 15 Mbps 15 Mbps
access link
consequences:
 LAN utilization: 15% problem! institutional
network
 access link utilization = 100% 100 Mbps LAN
 total delay = Internet delay + access
delay + LAN delay
= 2 sec + minutes + usecs
Computer Networking and Applications

Caching example: fatter access link


assumptions:
 avg object size: 1Mbit
 avg request rate from browsers to origin
origin
servers:15/sec servers
public
 avg data rate to browsers: 15 Mbps
Internet
 RTT from institutional router to any
origin server: 2 sec
 access link rate: 15 Mbps

consequences: 100 Mbps 15 Mbps


100 Mbps
 LAN utilization: 15%
access link
 access link utilization = 100%
15%
institutional
 total delay = Internet delay + access network
100 Mbps LAN
delay + LAN delay
= 2 sec + minutes + usecs
msecs

Cost: increased access link speed (not cheap!)


Computer Networking and Applications

Caching example: install local cache


Calculating access link
utilization, delay with cache: origin
servers
• suppose cache hit rate is 0.4 public
Internet
– 40% requests satisfied at cache, 60%
requests satisfied at origin
 access link utilization:
 60% of requests use access link 15 Mbps
access link
 data rate to browsers over access
link = 0.6*15 Mbps = 9 Mbps institutional
 utilization = 9 Mbps/15 Mbps = 60% network
100 Mbps LAN
 total delay
 = 0.6 * (delay fetching from origin servers) +0.4 local web
* (delay when satisfied at cache or LAN delay) cache
 = 0.6 (2.02) + 0.4 (~10 ms) Note: We neglected to LAN delay
 = ~ 1.2 secs and access link delay as these are
 less than with 100 Mbps link (and cheaper too!) negligile
Computer Networking and Applications

How do processes (browser


and webserver) communicate?
(socket programming)

See Sockets.PDF (next week)

You might also like