0% found this document useful (0 votes)
15 views26 pages

CCN Lecture 5

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)
15 views26 pages

CCN Lecture 5

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/ 26

Computer Communications

Networks
Lecture 5

Power point slides made with the help from the slides
came with the computer networking book written by Kurose
Web page
• Web page consists of objects, each of which can be stored
on different Web servers
• Object can be HTML file, JPEG image, video clip
• Web page consists of base HTML file which includes several
referenced objects, each addressable by a URL
• Each URL has two components
a) The hostname of the server that houses the object
b) The object’s path name
HTTP Overview
• HTTP: HyperText Transfer Protocol
(RFC 1945 (old version), RFC 7230, RFC 7540)
• Web’s application layer protocol
• Client/Server model:
a) Client: browser that requests, receives,
(using HTTP protocol) and displays Web
objects
b) Server: Web server sends (using HTTP
protocol) objects in response to
requests. Ex: Apache,
Microsoft’s web server
HTTP Overview

PC running
Firefox browser

server running
Apache Web
server

iPhone running
Safari browser
HTTP uses TCP
• Client initiates TCP connection (creates socket) to
server, port 80
• Server accepts TCP connection from client
• HTTP messages exchanged between browser and
web server
• TCP connection closed
HTTP Overview
• HTTP is “stateless”
- Server maintains no information about past client
requests
- It simplifies the server design
HTTP Connections: 2 types
1) Non-persistent HTTP
a) TCP connection opened
b) at most one object sent over TCP connection
c) TCP connection closed
* downloading multiple objects requires
multiple connections
2) Persistent HTTP
a)TCP connection opened to a server
b) multiple objects can be sent over single TCP
connection between client and server
c) TCP connection closed
Non-persistent HTTP: example
Non-persistent HTTP: example
Non-persistent HTTP: response time
• RTT – Round-trip time: Time for a small packet to travel from client to
server and back
• HTTP response time (per object):
a) One RTT to initiate TCP connection
b) One RTT for HTTP request and first
few bytes of HTTP response to return
c) object/ file transmission time

* Non-persistent HTTP response time


= 2RTT + file transmission time
Issues with Non-persistent HTTP
• Requires 2 RTT per object
• Significant burden on web server
• Browsers often open multiple parallel connections
to fetch referenced objects in parallel
Persistent HTTP (HTTP 1.1)
• Server leaves connection open after sending response
• An entire Web page can be sent over a single persistent
TCP connection
• Multiple Web pages residing on the same server can be
sent to the client over a single persistent TCP
connection
• Requests for objects can be made back-to-back without
waiting for replies to pending requests
• The HTTP server closes a connection when it isn’t used
for a certain time
• As little as one RTT for all the referenced objects
HTTP request message
• Two types of HTTP messages: request, response
• HTTP request message:
- ASCII (human readable format)
• Typical HTTP request message: Request line + Header lines
Request line GET /somedir/page.html HTTP/1.1 (method + URL + HTTP version)
Host: www.someschool.edu (the host on which the object resides)
Header lines Connection: close (close the connection after sending the requested object)
User-agent: Mozilla/5.0 (client browser type)
Accept-language: fr (user prefers to receive French version of the object)
• The method field can take several values like GET, POST, HEAD, PUT, DELETE
HTTP request message: general format

* sp: space, cr: carriage return character, lf: line feed character
HTTP Response Message
• Typical HTTP response message: status line + header lines + entity body
HTTP/1.1 200 OK (Status line: server HTTP version Status code)
Connection: close (telling the client it is closing the TCP connection)
Date: Tue, 18 Aug 2015 15:44:04 GMT (time and date when the HTTP
response was created)
Header lines

Server: Apache/2.2.3 (centOS) (The message is generated by Apache


Web server)
Last-Modified: Tue, 18 Aug 2015 15:11:03 GMT (time and date when the
object was last created or modified)
Content-Length: 6821 (number of bytes in the object being sent)
Content-Type: text/html (object in the entity body is HTML text)
data data … (Entity body: contains the requested object)
HTTP response status code
• Status code appears in the 1st line in server-to-client response message
• Some sample codes:
200 OK:
request succeeded, requested object later in this msg
301 Moved Permanently:
requested object moved, new location specified later in this message
(in location field)
304 Not Modified:
tells the client that the response has not been modified. So the client can use the
current version
400 Bad Request:
request msg not understood by server
404 Not Found:
requested document not found on this server
505 HTTP Version Not Supported:
The requested HTTP protocol version is not supported by the server
User-Server Interaction: Cookies
• Allows Web sites to identify and keep track of users
- Amazon uses cookies to provide its shopping cart service
- Netflix uses cookies to keep track of our viewing history
• When initial HTTP request arrives at site from a new user,
site creates:
- unique ID for the user (aka “cookie”)
- entry in the backend database for ID
• Subsequent HTTP requests from the same user to this site
will contain cookie ID value, allowing site to “identify” the
user
User-Server Interaction: Cookies
Four components of cookie technology
1. HTTP response message: set-cookie ---
2. HTTP request message: cookie: ----
3. Cookie file kept on the user’s end system
4. Back-end database at Web site
HTTP cookies: comments
What cookies can be used
for:
▪ authorization
cookies and privacy:
▪ shopping carts ▪ cookies permit sites to
▪ recommendations learn a lot about you on
▪ user session state (Web e-mail) their site.
▪ third party persistent
cookies (tracking cookies)
allow common identity
(cookie value) to be
tracked across multiple
web sites
Web Caches
• Aka proxy server
• Goal: Satisfy client request without involving origin
Web server
• The Web cache has its own disk storage and keeps
copies of recently requested objects
• User’s browser can be configured so that all of the
user’s HTTP requests are first directed to the Web
cache
Web Caches
• Browser sends all HTTP requests to cache
- if object in cache: cache returns object to client
- else cache requests object from origin server, caches
received object, then return object to the client
Web Caches
• Web cache acts as both client and server
- server for original requesting client
- client to origin server
• Typically a Web cache is purchased and installed by
an ISP
Why Web Caching?
• Reduce response time for client request
- cache is closer to client
• Reduce traffic on an institution’s access link
Caching example
Scenario:
• Access link rate: 1.54 Mbps
• RTT from institutional router to server: 2 sec
• Web object size: 100 k bits
• Average request rate from browsers to origin servers:
15/sec
- avg data rate to browsers: 1.50 Mbps
Performance:
• Access link utilization or traffic intensity = 0.97
• LAN utilization = 0.0015
• End-end delay = Internet delay +
access link delay +
LAN delay
= 2 sec + minutes + μsec
Caching example
• Access link delay is very long origin
servers
• Option 1: public
Internet
buy a faster access link (expensive)
• Option 2:
1.54 Mbps
install a web cache (cheap!) access link

institutional
network
1 Gbps LAN

local web cache


Performance with Cache
Suppose cache hit rate is 0.4:
• 40% requests served by cache, with low delay
• 60% requests satisfied at origin
- rate to browsers over access link = 0.6*1.5 Mbps
= 0.9 Mbps
- access link utilization = 0.9/1.54 = 0.58 means
low queueing delay at access link
• Average end-end delay:
= 0.6*(delay from origin servers) + 0.4*(delay when
satisfied at cache)
= 0.6(2.01) + 0.4(~msecs) = ~1.2 secs
Conditional GET
• The copy of the object in the cache might not be up to date

You might also like