0% found this document useful (0 votes)
7 views27 pages

Numericals 02

The document contains exercises and solutions related to computer networks, focusing on concepts such as port numbers, HTTP methods, persistent vs. non-persistent connections, and caching. It includes calculations for download times using different HTTP methods and discusses the differences between HTML and HTTP. Additionally, it addresses DNS delays and the impact of caching on network performance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views27 pages

Numericals 02

The document contains exercises and solutions related to computer networks, focusing on concepts such as port numbers, HTTP methods, persistent vs. non-persistent connections, and caching. It includes calculations for download times using different HTTP methods and discusses the differences between HTML and HTTP. Additionally, it addresses DNS delays and the impact of caching on network performance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Exercises

1. What are port numbers used for?


a) to identify specific interfaces of a router
b) to identify a process running on a host
c) to identify physical interfaces on a host
d) to identify a socket belonging to an application program
2. What popular application uses port number 80?
a) email
b) bit torrent
c) web server
d) Skype

Computer Networks 2
Exercises -- Solution
1. What are port numbers used for?
a) to identify specific interfaces of a router
b) to identify a process running on a host
c) to identify physical interfaces on a host
d) to identify a socket belonging to an application program
The answer is d)
2. What popular application uses port number 80?
a) email
b) bit torrent
c) web server
d) Skype
The
3 web uses port 80 as its default port
Computer Networks
Exercises
3. You may need to refer to RFC 2616 to answer
some of these questions
a. Explain the difference between HTML and HTTP
b. Why does HTTP use TCP rather than UDP?
c. What is the difference between a URI and a URL (and a URN)?
d. What is the maximum length of a URI in an HTTP message?
e. List five HTTP “methods”. What does the TRACE method do?
f. What does the date in an HTTP response signify?

Computer Networks 4
Exercises - solution
3. You may need to refer to RFC 2616 to answer
some of these questions
a. Explain the difference between HTML and HTTP

HTTP is an application-level protocol for distributed, collaborative,


hypermedia information systems (From FRC 2616).
HTML (HyperText Markup Language is a markup language used to
create web pages.

Computer Networks 5
Exercises - solution
3. You may need to refer to RFC 2616 to answer
some of these questions
a. Explain the difference between HTML and HTTP
b. Why does HTTP use TCP rather than UDP?

Uses the reliability of TCP.

Computer Networks 6
Exercises - Solution
c. What is the difference between a URI and a URL (and a
URN)?
A Uniform Resource Identifier URI identifies a name of a resource on the Internet.
It identifies the resource by name, location or both. It has two specializations,
Uniform Resource Locator URL and Uniform Resource Name URN. A URL has
two parts, a scheme, e.g., http or ftp, and a scheme specific part that has a
specific syntax, e.g.,

ftp://<user>:<password>@<host>:<port>/<url-path> or
http://<user>:<port>/<path>?<searchpart>.

A URN provides a globally unique and persistent name for a resource (a URL
would identify the location of an instance of a resource identified by an URN).

d. What is the maximum length of a URI in an HTTP


message?
From RFC 2616: Servers MUST be able to handle the URI of any resource they
serve and SHOULD be able to handle URIs of unbounded length if they provide
GET-based forms that could generate such URIs. 7
Exercises - Solution
e. List five HTTP “methods”. What does the TRACE method
do?
OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT

TRACE:

use to invoke a remote, application-layer loopback of the request message. The


final recipient of the request SHOULD reflect the message received back to the
client as the entity-body of a 200 (OK) response.

f. What does the date in an HTTP response signify?


Date and time at which the response was originated.

Computer Networks 8
Persistent vs. Non-
Persistent HTTP
 Non-persistent (1.0)
 browser opens separate TCP connection for every GET
request
 server closes connection after response is delivered
 simpler to implement but less-than-ideal performance
 Persistent (1.1)
 connection is kept open so long as requests continue
 browser may send GET requests for multiple objects, without
waiting for responses to earlier requests
 allows all objects on a web page to be retrieved in one RTT
 signal by including “Connection: keep-alive” in GET header
 Performance comparison for page with N objects
 non-persistent: 2(N+1) RTTs plus transmission time
• can improve using N parallel connections
 persistent: 3 RTTs plus transmission time
Computer Networks 9
Exercises
4. Consider a user with a 10 Mb/s DSL connection,
requesting a web page with 10 KB of text and links
to five images, each of which is 100 Kbytes long.
Assume that the user is in LA and the web server is
in NY, and the one way propagation delay is 25 ms.
a) how long does it take to download the web page + images using non-
persistent HTTP, with one connection open at a time?
b) how long does it take if the browser opens multiple connections?
c) how long does it take using persistent HTTP?

Computer Networks 10
Exercises - solution
4. Consider a user with a 10 Mb/s DSL connection, requesting
a web page with 10 KB of text and links to five images, each
of which is 100 Kbytes long. Assume that the user is in LA
and the web server is in NY, and the one way propagation
delay is 25 ms.
a) How long does it take to download the web page + images using
non-persistent HTTP, with one connection open at a time?
non-persistent: 2* (N+1) RTTs + Transmission time
2* (N+1) RTTs = 2 * (5 + 1) * 50ms = 600 ms = 0.6 sec
Transmission Time = L bits / R Transmission rate
= ((10KB + 5 * 100KB) * 8b/B) / 10Mb/s
= ((10000B + 500000B) * 8b/B) / 107 b/sec
= 4.08 x 106 b / (107 b/sec)
= 0.408 sec
Total Time = 0.600 sec + 0.408 sec = 1.008 sec
11
Exercises - solution
4. Consider a user with a 10 Mb/s DSL connection, requesting
a web page with 10 KB of text and links to five images, each
of which is 100 Kbytes long. Assume that the user is in LA
and the web server is in NY, and the one way propagation
delay is 25 ms.
a) how long does it take to download the web page + images using non-
persistent HTTP, with one connection open at a time?
b) How long does it take if the browser opens multiple
connections?
non-persistent: 2* (N+1) RTTs + Transmission time

= 2*(1+1)*50ms + (10,000+500,000)*8 / 10^7


=0.608 sec

Computer Networks 12
Exercises - solution
4. Consider a user with a 10 Mb/s DSL connection, requesting a web page
with 10 KB of text and links to five images, each of which is 100 Kbytes
long. Assume that the user is in LA and the web server is in NY, and the
one way propagation delay is 25 ms.
a) how long does it take to download the web page + images using non-persistent
HTTP, with one connection open at a time?
b) how long does it take if the browser opens multiple connections?
c) How long does it take using persistent HTTP?

Persistent = 3 * RTTs + Transmission time

= 3 * 50ms + (10,000+500,000)*8 / 10^7


= 0.558 sec

Computer Networks
13
Browser
Hint: If a request is cached, there is only
the RTT time, otherwise, you also
need to add the transmission time

Caching
Consider an HTTP server and client as shown in the figure below.
5.
Suppose that the RTT delay between the client and server is 30
msecs; the time a server needs to transmit an object into its
outgoing link is 0.5 msecs; and any other HTTP message not
containing an object has a negligible (zero) transmission time.
Suppose the client again makes 90 requests, one after the other,
waiting for a reply to a request before sending the next request.

 Assume the client is using HTTP 1.1 and 40% of the objects
requested have NOT changed since the client downloaded them
(before these 90 downloads are performed)
How much time elapses (in milliseconds) between the client
transmitting the first request, and the completion of the last request?
Computer Networks 14
Browser Caching -
solution
How much time elapses (in milliseconds) between the client
transmitting the first request, and the completion of the last request?
 To calculate the total time elapsed, we need to consider two
factors: the time taken by the server to transmit the object
and the time taken by the client to wait for a reply before
sending the next request
 For each request, the client sends the request to the server
and waits for the server's response. Here's the breakdown:
1. Time taken by the server to transmit the object: 0.5 msecs
2. RTT delay between the client and server (round trip time):
30 msecs
3. Time for the server to process the request and generate the
response: negligible (zero) transmission time for any HTTP
message not containing an object
4. Client waiting for the server's response: RTT delay
Computer Networks 15
Browser Caching -
solution
How much time elapses (in milliseconds) between the client
transmitting the first request, and the completion of the last request?
 Given that 40% of the objects requested have not
changed.
 Since the client waits for a reply before sending the next
request, the total time elapsed can be calculated as
follows:
1. Total time for transmitting the objects that have changed:
= (90 - 40) * (0.5 msec + RTT delay)
2. Time for the 40% of objects that have not changed: 40 *
RTT delay
 Adding these two times together gives the total time
elapsed between the client transmitting the first request
and the completion of the last request

Computer Networks 16
DNS and HTTP delays

Computer Networks 17
DNS and HTTP delays
 Suppose within your Web browser you click on a link to
obtain a Web page.
 The IP address for the associated URL is not cached in
your local host, so a DNS lookup is necessary to obtain
the IP address.
 Suppose that two DNS servers are visited before your
host receives the IP address from DNS.
 The first DNS server visited is the local DNS cache, with an RTT delay
of RTT0 = 1 msecs.
 The second DNS server contacted has an RTT of 30 msecs.
 Initially, let's suppose that the Web page associated with
the link contains exactly one object, consisting of a small
amount of HTML text.
 Suppose the RTT between the local host and the Web
server containing the object is RTTHTTP = 84 msecs.
Computer Networks 18
DNS and HTTP delays
6. A) Assuming zero transmission time for the HTML
object, how much time (in msec) elapses from when
the client clicks on the link until the client receives
the object?
The total amount of time to get the IP address at DNS is = RTT1
Once the IP address is known, RTT0 elapses to set up the TCP
connection and another RTT0 elapses to request and receive the small
object. The total response time is:
= 2RTT0 + RTT1= 2(1) + 30 = 32msec

non-persistent: 2* (N+1) RTTs +


Transmission time
= 2*(0+1)* 84msec + 0
=168 msec Total time = 168+32 = 200msec

Computer Networks 19
DNS and HTTP delays
B) Now suppose the HTML object references 2 very small objects on
the same server. Neglecting transmission times, how much time (in
msec) elapses from when the client clicks on the link until the base
object and all 2 additional objects are received from web server at the
client, assuming non-persistent HTTP and no parallel TCP connections?

The total amount of time to get the IP address at DNS is = RTT1


Once the IP address is known, RTT0 elapses to set up the TCP
connection and another RTT0 elapses to request and receive the small
object. The total response time is:
= 2RTT0 + RTT1= 2(1) + 30 = 32msec
non-persistent: 2* (N+1) RTTs +
Transmission time
= 2*(2+1)* 84mses + 0
Total time = 504+32 = 536msec
=504 msec
Computer Networks 20
Home Task
1. Suppose the HTML object references 2 very small
objects on the same server but assume that the
client is configured to support a maximum of 5
parallel TCP connections, with non-persistent HTTP.
2. Suppose the HTML object references 2 very small
objects on the same server but assume that the
client is configured to support a maximum of 5
parallel TCP connections, with persistent HTTP.
3. What's the fastest method we've explored:
Nonpersistent-serial, Nonpersistent-parallel, or
Persistent-parallel?

Computer Networks 21
Caching example:
assumptions:
 avg object size: 100K bits origin
 avg request rate from servers
browsers to origin public
servers:15/sec Internet
 avg data rate to browsers:
1.50 Mbps
 RTT from institutional router
1.54 Mbps
to any origin server: 2 sec
access link
 access link rate: 1.54 Mbps
problem! institutional
consequences: network
1 Gbps LAN
 LAN utilization: 15%
 access link utilization = 99%
 total delay = Internet delay
+ access delay + LAN delay
= 2 sec + minutes + usecs
Computer Networks 22
Caching example: fatter
access link
assumptions:
 avg object size: 100K bits origin
 avg request rate from servers
browsers to origin public
servers:15/sec Internet
 avg data rate to browsers:
1.50 Mbps
 RTT from institutional router to
any origin server: 2 sec154 1.54 Mbps
154 Mbps
access link rate: 1.54 Mbps access link

Mbps
institutional
consequences: network
 LAN utilization: 15% 9.9% 1 Gbps LAN
 access link utilization = 99%
 total delay = Internet delay +
access delay + LAN delay
msecs
= 2 sec + minutes + usecs
Cost: increased access link speed (not cheap!)
23
Computer Networks
Caching example: install local
cache
assumptions:
 avg object size: 100K bits origin
 avg request rate from servers
browsers to origin public
servers:15/sec Internet
 avg data rate to browsers:
1.50 Mbps
 RTT from institutional router to
any origin server: 2 sec 1.54 Mbps
 access link rate: 1.54 Mbps access link
institutional
consequences: network
 ?
LAN utilization: 15% 1 Gbps LAN
 ? utilization = 100%
access link local web
 Howdelay
total to compute link +
= Internet delay cache
utilization,
access delay + LAN delay?
delay
= 2 sec + minutes + usecs
Cost: web cache (cheap!)
24
Computer Networks
Caching example: install local
cache
Calculating access link
utilization, delay with cache:
 suppose cache hit rate is 0.4 origin
 40% requests satisfied at cache, 60% servers
requests satisfied at origin public
Internet

 access link utilization:


 60% of requests use access link
 data rate to browsers over access 1.54 Mbps
link = 0.6*1.50 Mbps = .9 Mbps access link
 utilization = 0.9/1.54 = .58
institutional
 total delay network
 = 0.6 * (delay from origin servers) +0.4 * (delay 1 Gbps LAN
when satisfied at cache)
 = 0.6 (2.0) + 0.4 (~msecs)
 = ~ 1.2 secs
local web
 less than with 154 Mbps link (and cheaper too!) cache

Computer Networks 25
Exercises
7. Suppose Wash. U. has an institutional web cache used by all students
and faculty and that during busy periods, the campus generates about
100 http get requests per second, with an average response size of 500
KB.
 What is the average resulting traffic on the university’s internet connection if
none of the requested web pages is in the cache?

 How does this change if 95% of the requested pages can be retrieved from
the cache?

26
Computer Networks
Exercises - solution
7. Suppose Wash. U. has an institutional web cache used by
all students and faculty and that during busy periods, the
campus generates about 100 http get requests per second,
with an average response size of 500 KB.
 What is the average resulting traffic on the university’s internet
connection if none of the requested web pages is in the cache?

Total web traffic is 100*500,000*8= 400 Mbits/sec w/o caching

 How does this change if 95% of the requested pages can be retrieved
from the cache?
Web traffic goes down to 5% of the above value with a cache hit ratio
of 95%, i.e., 20 Mbits/sec

27
Computer Networks

You might also like