0% found this document useful (0 votes)
21 views

Lecture 4 Slides

The document discusses HTTP and web caching, explaining that HTTP is stateless while cookies allow servers to maintain state about users, and that web caches like proxy servers aim to satisfy client requests without involving origin servers in order to reduce response times and traffic on access links. Persistent HTTP connections allow multiple objects to be sent over a single TCP connection between client and server.

Uploaded by

sh6k2hr6w8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture 4 Slides

The document discusses HTTP and web caching, explaining that HTTP is stateless while cookies allow servers to maintain state about users, and that web caches like proxy servers aim to satisfy client requests without involving origin servers in order to reduce response times and traffic on access links. Persistent HTTP connections allow multiple objects to be sent over a single TCP connection between client and server.

Uploaded by

sh6k2hr6w8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

CSEN 404

Introduction to Networks

Hisham Othman
Basma Mohamed Afifi
Nadeen Hamza

** Slides are attributed to J. F. Kurose


HTTP overview (continued)
Uses TCP: HTTP is “stateless”
 client initiates TCP connection  server maintains no
(creates socket) to server, port 80 information about past
 server accepts TCP connection client requests
from client
aside
 HTTP messages (application-layer Protocols that maintain “state” are
protocol messages) exchanged complex!
between browser (HTTP client)  past history (state) must be
and Web server (HTTP server) maintained
 TCP connection closed  if server/client crashes, their
views of “state” may be
inconsistent, must be
reconciled

2
HTTP connections
Nonpersistent HTTP Persistent HTTP
 At most one object is sent  Multiple objects can be sent

over a TCP connection over single TCP connection


between client and server

3
Nonpersistent HTTP

Suppose user enters URL www.someSchool.edu/someDepartment/home.index


(contains text, references to 10 jpeg images)

1a. HTTP client initiates TCP connection


to HTTP server (process) at
www.someSchool.edu on port 80
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
2. HTTP client sends HTTP request
message (containing URL) into
TCP connection socket. Message 3. HTTP server receives request
indicates that client wants object message, forms response message
someDepartment/home.index containing requested object, and
sends message into its socket

time
4
Nonpersistent HTTP (cont.)

4. HTTP server closes TCP


connection
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
time finds 10 referenced jpeg objects

6. Steps 1-5 repeated for each of 10


jpeg objects

5
Non-Persistent HTTP: Response time
6

Definition of RTT: time for a


small packet to travel from
client to server and back initiate TCP
connection
Response time:
RTT
 one RTT to initiate TCP request
connection file
time to
RTT
 one RTT for HTTP request transmit
file
and first few bytes of HTTP file
response to return received

 file transmission time time time


total = 2RTT+transmit time
Persistent HTTP

Nonpersistent HTTP issues: Persistent HTTP


 requires 2 RTTs per object  server leaves connection open
 OS overhead for each TCP after sending response
connection  subsequent HTTP messages
 browsers often open parallel TCP between same client/server sent
connections to fetch referenced over open connection
objects  client sends requests as soon as
 Default in HTTP/1.0 (if no it encounters a referenced
connection: keep-alive is present.) object
 as little as one RTT per
referenced object
 Default in HTTP/1.1 (if no
connection: close is present.)

7
Roadmap: Application layer

 Cookies and User-Server State


 Web caches (proxy server)

 DNS

8
Cookies and User-Server State
User-server state

 HTTP is stateless
 So how do web servers keep track of your
preferences?

10
User-server state: cookies
Many major Web sites use Example:
cookies  Susan access Internet always
Four components: from PC
1) cookie header line of HTTP
 visits specific e-commerce site
response message
2) cookie header line in HTTP for first time
request message  when initial HTTP requests
3) cookie file kept on user’s host, arrives at site, site creates:
managed by user’s browser
4) back-end database at Web  unique ID
site
 entry in backend
database for ID

11
Cookies: keeping “state” (cont.)

client server
ebay 8734
usual http request msg
Amazon server
cookie file usual http response creates ID
Set-cookie: 1678 1678 for user create
ebay 8734 entry
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
one week later: usual http response msg action backend
database
access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
spectific
usual http response msg action
12
Cookies (continued)
What cookies can bring:
aside
 authorization Cookies and privacy:
 user session state  cookies permit sites to
 E.g.: Web e-mail learn a lot about you
 shopping carts  you may supply name and
e-mail to sites
 recommendations

How to keep “state”:


 protocol endpoints: maintain state at
sender/receiver over multiple transactions
 cookies: http messages carry state

13
Web Cache / Proxy Server
Web caches (proxy server)

Goal: satisfy client request without involving origin server


 user sets browser: Web origin
server
accesses via cache
 browser sends all HTTP Proxy
requests to cache server
client
 object in cache: cache
returns object
 else cache requests object
from origin server, then
returns object to client
client
origin
server

15
More about Web caching
 Proxy server acts as both Why Web caching?
client and server  reduce response time for

client request
 Typically cache is installed  reduce traffic on an

by ISP, e.g.: institution’s access link


 University,  Internet dense with caches:
 Company, enables “poor” content
 Residential ISP providers to effectively
deliver content (but so does
P2P file sharing)

16
Caching example

origin
Assumptions
public servers
 average object size = 1Mbits Internet
2 sec delay
 avg. request rate from institution’s browsers to origin
servers = 15 req/sec Internet router

 delay from internet router to any origin server and 15 Mbps


back to router = 2 sec access link
Consequences institutional
network
 utilization on LAN = (15 requests/sec) × 100 Mbps LAN
(1Mbits/request)/(100Mbps) = 15%
 utilization on access link =La/R
 = (15 requests/sec) × (1Mbits/request)/(15Mbps) = 100%
 total delay=Internet delay + access delay + LAN delay
= 2 sec + Minutes + milliseconds
Dominant Delay Component
17
Caching example (cont)
origin
possible solution servers
public
 increase bandwidth of access link Internet
to, say, 100 Mbps
consequence Internet router

 utilization on LAN = 15% 100 Mbps


 utilization on access link = 15% access link

 Total delay = Internet delay + access institutional


delay + LAN delay network
100 Mbps LAN
= 2 sec + msecs + msecs
 often a costly upgrade because it is a
recurrent cost

Dominant Delay Component

18
Caching example (cont)

possible solution: install cache origin


 suppose cache hit rate is 0.4 public servers
consequence Internet

 40% requests will be satisfied Internet router


almost immediately
 60% requests satisfied by origin 15 Mbps
server access link
 utilization of access link reduced institutional
to 60%, resulting in negligible network
delays 100 Mbps LAN
 total avg delay = Internet delay
+ access delay + LAN delay =
0.6*(2) secs + msecs + msecs
 < 1.4 secs institutional
Dominant Delay Component
cache

19
Conditional GET

 Goal: don’t send object if cache cache server


has up-to-date cached version HTTP request msg
 cache: specify date of cached If-modified-since:
<date> object
copy in HTTP request not
If-modified-since: <date> modified
HTTP response
 server: response contains no object HTTP/1.0
if cached copy is up-to-date: 304 Not Modified

HTTP/1.0 304 Not Modified


HTTP request msg
If-modified-since:
<date> object
modified
HTTP response
HTTP/1.0 200 OK
<data>
20
DNS
DNS: Domain Name System

People: many identifiers: Domain Name System:


 SSN, name, passport #  distributed database implemented in
Internet hosts, routers: hierarchy of many name servers
 IP address (32 bit) - used for  application-layer protocol host,
addressing datagrams routers, name servers to
communicate to resolve names
 “name”, e.g., ww.yahoo.com - (address/name translation)
used by humans
 note: core Internet function,
Q: map between IP addresses implemented as application-
and name ? layer protocol
 complexity at network’s “edge”

22
DNS
23

DNS services Why not centralize DNS?


 Hostname-to-IP-address  single point of failure
translation  traffic volume

 host aliasing  distant centralized


 Canonical, alias names database
 mail server aliasing  Maintenance: update huge

 load distribution DB
 replicated Web servers: set
of IP addresses for one
canonical name doesn’t scale!
Distributed, Hierarchical Database
24

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

ietf.org poly.edu umass.edu


yahoo.com amazon.com
DNS servers DNS serversDNS servers
DNS servers DNS servers

Client wants IP for www.amazon.com; 1st approx:


 client queries a root server to find com DNS server

 client queries com DNS server to get amazon.com DNS server

 client queries amazon.com DNS server to get IP address for


www.amazon.com
DNS: Root Name Servers
 contacted by local name server that can not resolve name
 root name server:
 contacts authoritative name server if name mapping not known
 gets mapping
 returns mapping to local name server

a Verisign, Dulles, VA
c Cogent, Herndon, VA (also LA)
d U Maryland College Park, MD k RIPE London (also 16 other locations)
g US DoD Vienna, VA
h ARL Aberdeen, MD i Autonomica, Stockholm (plus
j Verisign, ( 21 locations) 28 other locations)
e NASA Mt View, CA m WIDE Tokyo (also Seoul,
f Internet Software C. Palo Alto, Paris, SF)
CA (and 36 other locations)

13 root name
b USC-ISI Marina del Rey, CA
l ICANN Los Angeles, CA
servers worldwide

25
TLD and Authoritative Servers
26

 Top-level domain (TLD) servers:


 responsible for com, org, net, edu, etc., as well as all
top-level country domains uk, fr, ca, jp.
 Network Solutions maintains servers for com TLD
 Educause for edu TLD

 Authoritative DNS servers:


 organization’sDNS servers, providing authoritative
hostname to IP mappings for organization’s servers
(e.g., Web, mail).
 can be maintained by organization or service provider
Local Name Server
27

 does not strictly belong to hierarchy


 each ISP (residential ISP, company, university) has
one
 also called “default name server”
 when host makes DNS query, query is sent to its
local DNS server
 acts as proxy, forwards query into hierarchy
DNS name root DNS server
resolution example
2
3
 Host at cis.poly.edu TLD DNS server
wants IP address for 4
gaia.cs.umass.edu 5

iterative query: local DNS server


dns.poly.edu
 contacted server replies
7 6
with name of server to 1 8
contact
 “I don’t know this name, authoritative DNS server
but ask this server” dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu

28
DNS name
resolution example root DNS server
29

recursive query: 2 3
 puts burden of name
7 6
resolution on contacted
name server TLD DNS server
 heavy load?
local DNS server
dns.poly.edu 5 4

1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu
DNS: caching and updating records

 once (any) name server learns mapping, it caches


mapping
 cache entries timeout (disappear) after some
time (often 48 hours)
 TLD servers typically cached in local name
servers
 Thus root name servers not often visited

30
DNS Problem
1-31
 Consider the network diagram on the right depicting three hosts H1, H2
and H3, as well as three levels of hierarchical DNS-Servers. The three
hosts perform a large number of domain-name lookups over the course
of a day.
 When a given DNS-request is in the zone of a name-server, this means
the server can resolve the domain-name directly, in other words it doesn't
have to propagate the request to the next level. Imagine for example
host H3 is issuing DNS-requests to DNS3. We say that the probability
(Pz) of that request being in DNS3's zone is 17% when the expected
number of requests DNS3 can resolve directly is 0.17 of the total number
of requests. This in turn means that 0.83 of all the requests to DNS3 have
to be propagated to DNS2.
 Furthermore, DNS2 and DNS3 perform caching. If for example the hit- Server Pz CHR
rate of a certain cache (denoted CHR) is 1/10, this means that on the DNS1 100% -
average, 1 in 10 requests can be resolved from that server's cache (the DNS2 43% 2/7
other 9 have to be resolved by propagation).
DNS3 17% 4/5
 Consider the table containing the probabilities and CHRs for the
three name-servers. What is the overall average RTT for
domain-name lookups, if RTT1, RTT2 and RTT3 denote the
round-trip time from Hx to servers DNS1, DNS2 and DNS3
respectively?
 Suppose 100 requests are sent to DNS3
Solution
1-32

 Consider the following:


 Of the 100 requests, how many will be resolved at server DNS3?
n3 = 17 + (4/5) * (100-17) = 83.4 (1)
 Of the 100 requests, how many will be resolved at DNS2? Here we need to remember, that out
of the 100 original packets, only some will be propagated to DNS2:
i2 = (100 - n3) = 16.6
where i2 is the number of requests propagated to DNS2. The number of requests found in DNS2
zone out of the i2 packets:
z2= 16.6 * (43/100) = 7.138
The number of requests resolved at DNS2 can now be calculated as follows:
n2 = 7.138 + (2/7) * (16.6-7.138) = 9.84 (2)
 Since DNS1 has Pz = 100%, all the remaining packets will be resolved at DNS1, namely:
n1 = 100 - 83.4 - 9.84 = 6.76 (3)
 Now we can calculate the weighted-average of the total RTT:
RTT =(1/100)* (RTT1*n1 + RTT2*n2 + RTT3* n3) (4)
Solution
1-33

in-zone in-cache up
# requests
DNS#
processed

DNS1 n1= 6.759 6.759

7.138+2.703
DNS2 7.138 2.703 6.759
n2 = 9.84

17+66.4
DNS3
n3 = 83.4
17 66.4 16.6
Summary
1-34

 HTTP over TCP connection


 Non-Persistent
 Persistent
 Cookies and User-Server State
 Web caches (proxy server)
 DNS
Any Question?
1-35

You might also like