Professional Documents
Culture Documents
Application Layer Overview and Web/HTTP
Application Layer Overview and Web/HTTP
Web/HTTP
Mrs. P N Jyothi
Assistant Professor
Dept of CSE,GIT,GITAM
Emailid:npothaba@gitam.edu
Visakhapatnam-530045
2
GITAM Institute of Technology,GITAM
Creating a network app
Write programs that application
transport
network
run on different end data link
physical
systems and
communicate over a
network.
e.g., Web: Web server
software communicates
with browser software
No software written for application
application
GITAM Institute of 4
Technology,GITAM
Client-server archicture
server:
always-on host
permanent IP address
server farms for scaling
clients:
communicate with server
may be intermittently
connected
may have dynamic IP
addresses
do not communicate
directly with each other
Examples?
5
GITAM Institute of Technology,GITAM
Pure P2P architecture
no always on server
arbitrary end systems
directly communicate
peers are intermittently
connected and change IP
addresses
example: Gnutella
Highly scalable
7
GITAM Institute of Technology,GITAM
Processes communicating
Process: program running Client process: process
within a host. that initiates
within same host, two communication
processes communicate Server process: process
using inter-process that waits to be
communication (defined contacted
by OS).
processes in different Note: applications with
hosts communicate by P2P architectures have
exchanging messages client processes &
server processes
8
GITAM Institute of Technology,GITAM
Sockets
host or host or
process sends/receives server
server
messages to/from its
socket controlled by
app developer
socket analogous to door process process
Port = 80 Port = 25
TCP
IP = 138.110.1.1
GITAM Institute of 10
Technology,GITAM
App-layer protocol defines
Types of messages Public-domain protocols:
exchanged, eg, request & defined in RFCs
response messages
allows for
Syntax of message
types: what fields in interoperability
messages & how fields eg, HTTP, SMTP
are delineated Proprietary protocols:
Semantics of the fields,
eg, KaZaA
ie, meaning of
information in fields
Rules for when and how
processes send &
respond to messages
GITAM Institute of 11
Technology,GITAM
Applications and App-Layer Protocols
UI
HTTP
Web Server
Web Browser
File
HTTP … Access
12
GITAM Institute of Technology,GITAM
What transport service does an app need?
Data loss Bandwidth
some apps (e.g., audio) can some apps (e.g.,
tolerate some loss multimedia) require
other apps (e.g., file minimum amount of
transfer, telnet) require bandwidth to be
100% reliable data “effective”
transfer other apps (“elastic
Timing apps”) make use of
some apps (e.g., whatever bandwidth they
Internet telephony, get
interactive games)
require low delay to be
“effective”
GITAM Institute of 13
Technology,GITAM
Transport service requirements of common apps
14
GITAM Institute of Technology,GITAM
Internet transport protocols services
Application Underlying
Application layer protocol transport protocol
16
GITAM Institute of Technology,GITAM
Web and HTTP
First some jargon
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
Example URL:
www.someschool.edu/someDept/pic.gif
GITAM Institute of 17
Technology,GITAM
HTTP overview
HTTP: hypertext
transfer protocol HT
TP
r
equ
Web’s application layer PC running HT est
TP
protocol Explorer res
pon
se
client/server model
client: browser that
e st
u
requests, receives, P r eq se Server
T o n
“displays” Web objects HT r es
p running
T P Apache Web
server: Web server HT
server
sends objects in
response to requests
Mac running
HTTP 1.0: RFC 1945 Navigator
HTTP 1.1: RFC 2068
GITAM Institute of 18
Technology,GITAM
HTTP overview (continued)
Uses TCP: HTTP is “stateless”
client initiates TCP server maintains no
connection (creates socket) information about
to server, port 80 past client requests
server accepts TCP
connection from client aside
Protocols that maintain
HTTP messages (application- “state” are complex!
layer protocol messages) past history (state) must
exchanged between browser be maintained
(HTTP client) and Web if server/client crashes,
server (HTTP server)
their views of “state” may
TCP connection closed
be inconsistent, must be
reconciled
19
GITAM Institute of Technology,GITAM
HTTP
PC running
Explorer
TCP O
pe n?
OK
HTTP
GE T…
Data
TCP Close
GITAM Institute of 20
Technology,GITAM
HTTP connections
Nonpersistent HTTP Persistent HTTP
At most one object is Multiple objects can
sent over a TCP be sent over single
connection. TCP connection
HTTP/1.0 uses between client and
nonpersistent HTTP server.
HTTP/1.1 uses
persistent connections
in default mode
21
GITAM Institute of Technology,GITAM
Nonpersistent HTTP
TCP O
pe n?
OK
HTTP
GE T ind
ex.ht
m
Data
TCP Close
TCP O
pe n?
OK
HTTP
GE T sam
i.jpg
Data
TCP Close
GITAM Institute of 22
Technology,GITAM
Response time modeling
Definition of RRT: time to
send a small packet to
travel from client to
server and back. initiate TCP
Response time: connection
RTT
one RTT to initiate TCP
request
connection file
time to
one RTT for HTTP request RTT
transmit
and first few bytes of file
file
HTTP response to return received
file transmission time
total = 2RTT+transmit time time time
23
GITAM Institute of Technology,GITAM
Persistent HTTP
24
GITAM Institute of Technology,GITAM
Persistent HTTP
TCP O
pe n?
OK
HTTP
GE T ind
ex.ht
m
Data
HTTP
GE T sam
i.jpg
Data
TCP Close
25
GITAM Institute of Technology,GITAM
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
ASCII (human-readable format)
request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) Host: www.someschool.edu
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr
Carriage return,
line feed (extra carriage return, line feed)
indicates end
of message
26
GITAM Institute of Technology,GITAM
HTTP request message: general format
27
GITAM Institute of Technology,GITAM
Uploading form input
Post method:
Web page often
includes form input URL method:
Input is uploaded to Uses GET method
server in entity body Input is uploaded in
URL field of request
line:
www.somesite.com/animalsearch?monkeys&banana
28
GITAM Institute of Technology,GITAM
Method types
HTTP/1.0 HTTP/1.1
GET GET, POST, HEAD
POST PUT
HEAD uploads file in entity
body to path specified
asks server to leave
in URL field
requested object out of
response DELETE
deletes file specified in
the URL field
29
GITAM Institute of Technology,GITAM
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html
30
GITAM Institute of Technology,GITAM
HTTP response status codes
In first line in server->client response message.
A few sample codes:
200 OK
request succeeded, requested object later in this message
301 Moved Permanently
requested object moved, new location specified later in
this message (Location:)
400 Bad Request
request message not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
GITAM Institute of 31
Technology,GITAM
Trying out HTTP (client side) for yourself
GITAM Institute of 32
Technology,GITAM
User-server state: cookies
Many major Web sites Example:
use cookies Susan access Internet
Four components: always from same PC
She visits a specific e-
1) cookie header line in
commerce site for first
the HTTP response
time
message
When initial HTTP
2) cookie header line in
requests arrives at site,
HTTP request message
site creates a unique ID
3) cookie file kept on and creates an entry in
user’s host and managed backend database for
by user’s browser ID
4) back-end database at
Web site
33
GITAM Institute of Technology,GITAM
Cookies: keeping “state” (cont.)
client server
Cookie file usual http request msg server ne
da try i
tab n b
usual http response + creates ID as ac
e ke
ebay: 8734 Set-cookie: 1678 1678 for user nd
Cookie file
usual http request msg
amazon: 1678 cookie: 1678 cookie- ss
ebay: 8734 specific acce
usual http response msg action
ss
one week later:
ce
ac
usual http request msg
Cookie file cookie-
cookie: 1678
amazon: 1678 spectific
ebay: 8734 usual http response msg action
34
GITAM Institute of Technology,GITAM
Cookies (continued)
aside
What cookies can bring: Cookies and privacy:
authorization cookies permit sites to
shopping carts learn a lot about you
you may supply name
recommendations
and e-mail to sites
user session state
search engines use
(Web e-mail)
redirection & cookies
to learn yet more
advertising companies
obtain info across
sites
35
GITAM Institute of Technology,GITAM
Web caches (proxy server)
Goal: satisfy client request without involving origin server
36
GITAM Institute of Technology,GITAM
More about Web caching
Cache acts as both client Why Web caching?
and server Reduce response time for
Typically cache is installed
client request.
by ISP (university, Reduce traffic on an
company, residential ISP) institution’s access link.
Internet dense with caches
enables “poor” content
providers to effectively
deliver content (but so
does P2P file sharing)
37
GITAM Institute of Technology,GITAM
Caching example
origin
Assumptions
servers
average object size = 100,000
bits public
avg. request rate from Internet
38
GITAM Institute of Technology,GITAM
Caching example (cont)
origin
Possible solution
servers
increase bandwidth of access
public
link to, say, 10 Mbps
Internet
Consequences
utilization on LAN = 15%
utilization on access link = 15%
10 Mbps
Total delay = Internet delay +
access link
access delay + LAN delay
institutional
= 2 sec + msecs + msecs network
often a costly upgrade 10 Mbps LAN
institutional
cache
39
GITAM Institute of Technology,GITAM
Caching example (cont)
origin
Install cache servers
suppose hit rate is .4 public
Consequence Internet
40% requests will be
satisfied almost immediately
60% requests satisfied by
origin server 1.5 Mbps
access link
utilization of access link
reduced to 60%, resulting in institutional
negligible delays (say 10 network
10 Mbps LAN
msec)
total avg delay = Internet
delay + access delay + LAN
delay = .6*(2.01) secs +
milliseconds < 1.4 secs institutional
cache
40
GITAM Institute of Technology,GITAM
Conditional GET