IT 424 Networks2
-
Upload
regan-rutledge -
Category
Documents
-
view
39 -
download
0
description
Transcript of IT 424 Networks2
![Page 1: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/1.jpg)
IT 424
Networks2IT 424
Networks2
Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross
Chapter 2: Application Layer
Chapter 2: Application Layer
Part 1: Client Server -
Part 1: Client Server -
WWW & HTTP
WWW & HTTP
![Page 2: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/2.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
2
![Page 3: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/3.jpg)
Learning Outcomes
1To describe the functions of the World Wide Web (WWW)
2 To explain the messages exchanged and the role of the different fields
3To differentiate between persistent and non persistent protocol
4 To describe the role of cookies
5To analyse the optimization in performance using proxy servers
3
![Page 4: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/4.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
4
![Page 5: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/5.jpg)
HTTP & The Web - Introduction
Application Layer Protocol Defines:
Types of messages exchanged, e.g., request, response
Message syntax: what fields in messages & how
fields are delineated
Message semantics meaning of information in fields
Rules for when and how processes send & respond to messages
Open protocols: Defined in RFCs Allows for interoperabilityE.g., HTTP, SMTP
Proprietary protocols: E.g., Skype
5
![Page 6: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/6.jpg)
First, a review…
Web page consists of objects
Object can be HTML file, JPEG image, Java applet, audio file,…
Web page consists of base HTML-file which includes several referenced objects
Each object is addressable by a URL, e.g.,
Web and HTTP
www.someschool.edu/someDept/pic.gif
host name path name
HTTP & The Web – Introduction
6
![Page 7: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/7.jpg)
HTTP: hypertext transfer protocol
Web’s application layer protocol
Client/server model
Client: browser that requests, receives, (using HTTP protocol) and “displays” Web objects
Server: Web server sends (using HTTP protocol) objects in response to requests
HTTP Overview (RFC1945)
PC runningFirefox browser
server running
Apache Webserver
iphone runningSafari browser
HTTP requestHTTP response
HTTP request
HTTP response
HTTP & The Web – HTTP Overview
7
![Page 8: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/8.jpg)
HTTP Overview (cont.)
Uses TCP:Client initiates TCP connection (creates socket) to server, port 80Server accepts TCP connection from clientHTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)TCP connection closed
HTTP is “stateless”Server maintains no information about past client requests
Protocols that maintain “state” are complex!
Past history (state) must be maintained
If server/client crashes, their views of “state” may be inconsistent, must be reconciled
aside
HTTP & The Web – HTTP Overview
8
![Page 9: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/9.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
9
![Page 10: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/10.jpg)
Persistent Vs. Non Persistent HTTP
HTTP Connections
Non-persistent HTTPAt most one object sent over TCP connection
Connection then closedDownloading multiple objects required multiple connections
Persistent HTTPMultiple objects can be sent over single TCP connection between client, server
10
![Page 11: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/11.jpg)
Non-Persistent HTTP
1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80
2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index
1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client
3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket
Suppose user enters URL: (contains text, references to 10 jpeg images)www.someSchool.edu/someDepartment/home.index
Persistent Vs. Non Persistent HTTP
11
![Page 12: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/12.jpg)
Non-Persistent HTTP(cont.)
5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of 10 jpeg objects
4. HTTP server closes TCP connection.
Persistent Vs. Non Persistent HTTP
12
![Page 13: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/13.jpg)
RTT (definition): time for a small packet to travel from client to server and back
HTTP response time:•One RTT to initiate TCP connection•One RTT for HTTP request and first few bytes of HTTP response to return•File transmission time•Non-persistent HTTP response time =
• 2RTT+ file transmission time
Non-Persistent HTTP: Response Time
time to transmit file
initiate TCPconnection
RTT
requestfile
RTT
filereceived
time time
Persistent Vs. Non Persistent HTTP
13
![Page 14: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/14.jpg)
Persistent VS. Non Persistent HTTP
Non-persistent HTTP issues:Requires 2 RTTs per objectOS overhead for each TCP connectionBrowsers often open parallel TCP connections to fetch referenced objects
Persistent HTTP:Server leaves connection open after sending responseSubsequent HTTP messages between same client/server sent over open connectionClient sends requests as soon as it encounters a referenced objectAs little as one RTT for all the referenced objects
Persistent Vs. Non Persistent HTTP
14
![Page 15: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/15.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
15
![Page 16: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/16.jpg)
HTTP Messages
Two types of HTTP messages:1- request, 2- response
ASCII (human-readable format)
Messages of HTTP
16
![Page 17: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/17.jpg)
HTTP Request Message:
Messages of HTTP - Request Message
request line(GET, POST, HEAD commands)
header lines
carriage return, line feed at startof line indicatesend of header lines
GET /index.html HTTP/1.1\r\nHost: www-net.cs.umass.edu\r\nUser-Agent: Firefox/3.6.10\r\nAccept: text/html,application/xhtml+xml\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7\r\nKeep-Alive: 115\r\nConnection: keep-alive\r\n\r\n
carriage return character
line-feed character
17
![Page 18: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/18.jpg)
HTTP Request Message: General Format
Messages of HTTP - Request Message
18
![Page 19: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/19.jpg)
Uploading Form Input
POST method: Web page often includes form input Input is uploaded to server in entity body
URL method: Uses GET method Input is uploaded in URL field of request line:
www.somesite.com/animalsearch?monkeys&banana
Messages of HTTP - Request Message
19
![Page 20: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/20.jpg)
Method Types
HTTP/1.0:GET
POST
HEAD Asks server to leave requested
object out of response
HTTP/1.1:GET, POST, HEAD
PUT Uploads file in entity body to
path specified in URL field
DELETE Deletes file specified in the URL
field
Messages of HTTP - Request Message
20
![Page 21: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/21.jpg)
HTTP Response Message:
Messages of HTTP - Response Message
status line(protocolstatus codestatus phrase)
header lines
data, e.g., requestedHTML file
HTTP/1.1 200 OK\r\nDate: Sun, 26 Sep 2010 20:09:20 GMT\r\nServer: Apache/2.0.52 (CentOS)\r\nLast-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\nETag: "17dc6-a5c-bf716880"\r\nAccept-Ranges: bytes\r\nContent-Length: 2652\r\nKeep-Alive: timeout=10, max=100\r\nConnection: Keep-Alive\r\nContent-Type: text/html; charset=ISO-8859-1\r\n\r\ndata data data data data ...
21
![Page 22: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/22.jpg)
HTTP Response Status Codes
200 OK request succeeded, requested object later in this msg
301 Moved Permanently requested object moved, new location specified later in this msg (Location:)
400 Bad Request request msg not understood by server
404 Not Found requested document not found on this server
505 HTTP Version Not Supported
Status code appears in 1st line in server-to-client response message. Some sample codes:
Messages of HTTP – Response Message
22
![Page 23: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/23.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
23
![Page 24: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/24.jpg)
The Role Of Cookies
User-Server State: Cookies
Many Web sites use cookiesFour components:
1) Cookie header line of HTTP response message
2) Cookie header line in next HTTP request message
3) Cookie file kept on user’s host, managed by user’s browser
4) Back-end database at Web site
Example:Susan always access Internet from PCVisits specific e-commerce site for first timeWhen initial HTTP requests arrives at site, site creates:
unique ID entry in backend database for ID
24
![Page 25: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/25.jpg)
Cookies: Keeping “State”
client server
usual http response msg
usual http response msg
cookie file
one week later:
usual http request msgcookie: 1678 cookie-
specificaction
access
ebay 8734usual http request msg Amazon server
creates ID1678 for user create
entry
usual http response set-cookie: 1678
ebay 8734amazon 1678
usual http request msgcookie: 1678 cookie-
specificaction
access
ebay 8734amazon 1678
backenddatabase
The Role Of Cookies
25
![Page 26: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/26.jpg)
Cookies
What cookies can be used for:AuthorizationShopping cartsRecommendationsUser session state (Web e-mail)
How to keep “state”:Protocol endpoints: maintain state at sender/receiver over multiple transactionsCookies: http messages carry state
Cookies and privacy: Cookies permit sites to learn a lot
about you You may supply name and e-mail
to sites
aside
The Role Of Cookies
26
![Page 27: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/27.jpg)
HTTP Pr
otoc
ol &
the W
eb
Persiste
nt Vs. N
on Persiste
nt HTTP
Messages of HTTP
The role of Cookies
Web Caches (Proxy Servers)
Overview
27
![Page 28: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/28.jpg)
Goal: satisfy client request without involving origin server
User sets browser: Web accesses via cache
Browser sends all HTTP requests to cache
Object in cache: cache returns object
Else cache requests object from origin server, then returns object to client
Web Caches (Proxy Server)
client
proxyserver
client
HTTP request
HTTP response
HTTP request HTTP request
origin server
origin server
HTTP response HTTP response
Web Caches (Proxy Servers)
28
![Page 29: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/29.jpg)
More About Web Caching
Cache acts as both client and server server for original requesting
client client to origin server
Typically cache is installed by ISP (university, company, residential ISP)
Why Web caching?Reduce response time for client requestReduce traffic on an institution’s access linkInternet dense with caches: enables “poor” content providers to effectively deliver content (so too does P2P file sharing)
Web Caches (Proxy Servers)
29
![Page 30: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/30.jpg)
Assumptions: Avg object size: 100K bits Avg request rate from browsers to
origin servers:15/sec Avg data rate to browsers: 1.50 Mbps RTT from institutional router to any
origin server: 2 sec Access link rate: 1.54 Mbps
Consequences: LAN utilization =0.15% Access link utilization = 97% Total delay = Internet delay + access
delay + LAN delay = 2 sec + minutes + usecs
Caching Example
originservers
public Internet
institutionalnetwork
1 Gbps LAN
1.54 Mbps access link
Web Caches (Proxy Servers) - Caching Example
problem!
30
![Page 31: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/31.jpg)
Caching Example: Fatter Access
Link origin
serverspublic
Internet
institutionalnetwork
1 Gbps LAN
1.54 Mbps access link
Assumptions: Avg object size: 100K bits Avg request rate from browsers to origin
servers:15/sec Avg data rate to browsers: 1.50 Mbps RTT from institutional router to any
origin server: 2 sec Access link rate: 1.54 Mbps
consequences: LAN utilization: 0.15% Access link utilization = 97% Total delay = Internet delay + access
delay + LAN delay = 2 sec + minutes + usecs
msecs
9.7%
154 Mbps
Cost: increased access link speed (not cheap!)
154 Mbps
Web Caches (Proxy Servers) - Caching Example
31
![Page 32: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/32.jpg)
Caching Example: Install Local
Cache origin
servers
1.54 Mbps access link
public Internet
institutionalnetwork
1 Gbps LAN
local web cache
Assumptions: Avg object size: 100K bits Avg request rate from browsers to origin
servers:15/sec Avg data rate to browsers: 1.50 Mbps RTT from institutional router to any origin
server: 2 sec Access link rate: 1.54 Mbps
Consequences: LAN utilization: 0.15% Access link utilization = Total delay =
??
How to compute link utilization, delay?
Cost: web cache (cheap!)
Web Caches (Proxy Servers) - Caching Example
32
![Page 33: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/33.jpg)
Caching Example: Install Local
Cache Calculating access link utilization, delay with
cache: Suppose cache hit rate is 0.4
40% requests satisfied at cache, 60% requests satisfied at origin
access link utilization: 60% of requests use access link
data rate to browsers over access link = 0.6*1.50 Mbps = .9 Mbps
utilization = 0.9/1.54 = .58 Total delay
= 0.6 * (delay from origin servers) +0.4 * (delay when satisfied at cache)
= 0.6 (2.01) + 0.4 (~msecs) = ~ 1.2 secs less than with 154 Mbps link (and
cheaper too!)
originservers
1.54 Mbps access link
public Internet
institutionalnetwork
1 Gbps LAN
local web cache
Web Caches (Proxy Servers) - Caching Example
33
![Page 34: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/34.jpg)
Goal: don’t send object if cache has up-to-date cached version
no object transmission delay lower link utilization
Cache: specify date of cached copy in HTTP request
If-modified-since: <date>
Server: response contains no object if cached copy is up-to-date:
HTTP/1.0 304 Not Modified
Conditional GET
HTTP request msgIf-modified-since: <date>
HTTP responseHTTP/1.0
304 Not Modified
object not
modifiedbefore<date>
HTTP request msgIf-modified-since: <date>
HTTP responseHTTP/1.0 200 OK
<data>
object modified
after <date>
serverclient
Web Caches (Proxy Servers) – Conditional GET
34
![Page 35: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/35.jpg)
Conclusion
Conclusion
Application layer protocols define type of messages, message syntax and semantics, and rules of processing
HTTP is web’s application layer protocol. It is a stateless protocol that follows client-server architecture
Persistent HTTP requires less time (1RTT only) for each referenced object
Cookies can be used to relief users. However, they permit sites to learn a lot about them
Web caching reduces response time and traffic
35
![Page 36: IT 424 Networks2](https://reader036.fdocuments.in/reader036/viewer/2022062721/568136c6550346895d9e643d/html5/thumbnails/36.jpg)
References
References
Computer Networking: A Top-Down Approach Featuring the Internet by James Kurose and Keith Ross, Addison Wesley, 2012 (chapter 2 )
Hypertext Transfer Protocol(RFC1945)
36