Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

CS232

Computer Networks

Topics:
Summer 2024
• Application Layer (Ch. 2)
Sayeed Ghani • Web & HTTP
Lecture 13 • Persistent vs Non-persistent HTTP

Sunday, July 7th


Link Utilization

A1
Utilization
= fraction of used bandwidth
= throughput / Link bandwidth

Bottleneck
Throughput (A1-B1) 400 Mbps / 4
= Min (60, 100, 90) = 60 Mbps = 100 Mbps

Utilization of Rs = 60/60 = 1.0 = 100%

Utilization of R = 60 * 4 / 400 = 240/400


= 0.6 = 60%
Utilization of Rc = 60/90 = 0.67 = 67%
B1

Application Layer: 2-2


Application layer: overview
▪ P2P applications
▪ Principles of network ▪ video streaming and content
applications distribution networks
▪ Web and HTTP ▪ socket programming with
▪ E-mail, SMTP, IMAP UDP and TCP
▪ The Domain Name System
DNS

Application Layer: 2-3


Web and HTTP
First, a quick review…
▪ web page consists of objects, each of which can be stored on
different Web servers
▪ object can be HTML file, JPEG image, Java applet, audio file,…
▪ web page consists of base HTML-file which includes several
referenced objects, each addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif

host name path name

Application Layer: 2-4


UPM website
Many objects

HTML file

Lots of
images

Application Layer: 2-5


Introduction

Internet protocol stack

▪ application: supporting network


applications application
• FTP, SMTP, HTTP
▪ transport: process-process data transfer transport
• TCP, UDP
▪ network: routing of datagrams from network
source to destination
• IP, routing protocols
link
▪ link: data transfer between neighboring
network elements
• Ethernet, 802.111 (WiFi), PPP physical
▪ physical: bits “on the wire”

1-6
An application-layer protocol defines:
▪ types of messages exchanged, open protocols:
• e.g., request, response ▪ defined in RFCs, everyone
▪ message syntax: has access to protocol
• what fields in messages & definition
how fields are delineated ▪ allows for interoperability
▪ message semantics ▪ e.g., HTTP, SMTP
• meaning of information in proprietary protocols:
fields
▪ e.g., Skype, Zoom
▪ rules for when and how
processes send & respond to
messages
Application Layer: 2-7
HTTP overview
HTTP: hypertext transfer protocol
▪ Web’s application-layer protocol
▪ client/server model: PC running
• client: browser that requests, Firefox browser
receives, (using HTTP protocol) and
“displays” Web objects
server running
• server: Web server sends (using Apache Web
HTTP protocol) objects in response server
to requests
iPhone running
Safari browser

Application Layer: 2-8


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

Application Layer: 2-9


message
source HTTP / TCP Layers
M application
segment Ht M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
link
physical

switch

destination Hn Ht M network
M application Hl Hn Ht M link Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical

1-10
UDP Packets

UDP = Packets can independently travel over different routes

1-11
Introduction

TCP Connection

access access
4321 access
net net

net
access
access net
net
access
access net
net

global
access
net
ISP access
net

access
net
access
net

access
net
access
net
access access
net access
net
net 4321
1-12
TCP connection = All packets will travel over same route
HTTP connections: two types
Non-persistent HTTP
1. TCP connection opened
2. at most one object sent
over TCP connection
3. TCP connection closed
downloading multiple
objects required multiple
connections

Application Layer: 2-13


Non-persistent HTTP: example
User enters URL: www.someSchool.edu/someDepartment/home.index
(containing text, references to 10 jpeg images)

1a. HTTP client initiates TCP


connection to HTTP server 1b. HTTP server at host
(process) at www.someSchool.edu on www.someSchool.edu waiting for TCP
port 80 connection at port 80 “accepts”
connection, notifying client
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request message,
socket. Message indicates forms response message containing
time that client wants object requested object, and sends message
someDepartment/home.index into its socket
Application Layer: 2-14
Non-persistent HTTP: example (cont.)
User enters URL: www.someSchool.edu/someDepartment/home.index
(containing text, references to 10 jpeg images)

4. HTTP server closes TCP


5. HTTP client receives response connection.
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
time

Application Layer: 2-15


Non-persistent HTTP: response time

RTT (definition): time for a small


packet to travel from client to initiate TCP
server and back connection
RTT
HTTP response time (per object):
▪ one RTT to initiate TCP connection request file
▪ one RTT for HTTP request and first few RTT time to
transmit
bytes of HTTP response to return file
file received
▪ object/file transmission time

time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Application Layer: 2-16
Animation

https://media.pearsoncmg.com/ph/esm/ecs_kurose_compnetwork_8/cw/content/interactiveanimat
ions/http-delay-estimation/index.html

Application Layer: 2-17


HTTP connections: two types
Non-persistent HTTP Persistent HTTP
1. TCP connection opened ▪TCP connection opened to
2. at most one object sent a server
over TCP connection ▪multiple objects can be
3. TCP connection closed sent over single TCP
connection between client,
downloading multiple and that server
objects required multiple ▪TCP connection closed
connections

Application Layer: 2-18


Persistent HTTP (HTTP 1.1)
Non-persistent HTTP issues: Persistent HTTP (HTTP1.1):
▪ requires 2 RTTs per object ▪ server leaves connection open after
▪ OS overhead for each TCP sending response
connection ▪ subsequent HTTP messages
▪ browsers often open multiple between same client/server sent
parallel TCP connections to over open connection
fetch referenced objects in ▪ client sends requests as soon as it
parallel encounters a referenced object
▪ as little as one RTT for all the
referenced objects (cutting
response time in half)
Application Layer: 2-19
HTTP request message
▪ two types of HTTP messages: request, response
▪ HTTP request message:
• ASCII (human-readable format)
carriage return character
line-feed character
request line (GET, POST,
GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X
10.15; rv:80.0) Gecko/20100101 Firefox/80.0 \r\n
header Accept: text/html,application/xhtml+xml\r\n
lines Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Connection: keep-alive\r\n
\r\n
carriage return, line feed
at start of line indicates
end of header lines * Check out the online interactive exercises for more
examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-20
HTTP request message: general format
method sp URL sp version cr lf request
line
header field name value cr lf
header
~
~ ~
~ lines

header field name value cr lf


cr lf

~
~ entity body ~
~ body

Application Layer: 2-21

You might also like