Please enable JavaScript.
Coggle requires JavaScript to display documents.
CHAPTER 2: APPLICATION LAYER - Coggle Diagram
CHAPTER 2: APPLICATION LAYER
APPLIES ON SOFTWARE APPLICATION:
email
web
text messages
voice over
video stream
2.2 THE WEB AND HTTP
2.2.1 OVERVIEW
WEB
operates on demand (what they want, they'll have it)
Everyone can be publisher of content
Contains hyperlinks & search engines to find published content
Serves as a platform for killer applications (yt, gmail,fb)
WEB PAGE
Consist of object
able to store on different Web server
e.g of object: HTML file, JPEG, audio file, Java applet
object is a collection of items that can be called from a
single URL
Consist of Base HTML-file
Include several referenced objects
each object is addressable by a URL (Uniform Resource
Locator or Web address)
host name, path name
HTTP
implement 2 programs
client program
browser that requests, receives,
“displays” Web objects
server program
Web server sends objects in
response to requests
uses TCP
sends HTTP request/receives messages into/from its socket interface ( The server does the same)
communication
i) Client initiates TCP connection (creates socket) to server,
port 80
ii) Server accepts TCP connection from client
iii) HTTP messages exchanged between browser (HTTP client) & Web server (HTTP server)
iv) TCP connection closed
characteristics
a "stateless" protocol
the server sends requested files to clients without storing
any state information about the client
server maintains no information on past client
requests
When client ask for the same object repeatedly, the
server will resend
connections
persistent
(HTTP) connections
all request/response be sent over the same TCP connection
multiple objects sent over single TCP between client & server
RTT procedure
server leaves connection open after sending response
responsible HTTP messages on same client/server, sent over open connection
client send request soon as it encounter required object
1 RTT required for all required objects
non-persistent
(HTTP) connections
each request/response be sent over separate TCP connection
at most one object sent over TCP, then it closed
downloading multiple objects require multiple connections
RESPONSE TIME
ROUND-TRIP TIME (RTT)
Time for a small packet to travel from client to server and back
HTTP response time per object
1 RTT = 1 TCP connection
1 RTT = HTTP request
object/file transmission file
non-persistent HTTP response time = 2 RTT + file transmission time
each object requires 2 RTT delay
2.2.2 HTTP request messages
2 types of HTTP messages
request
response
REQUEST LINE
GET, POST, HEAD command
\r\n : carriage return, line feed at start
of line indicates end of header lines
page37,38 slides
UPLOADING FORM INPUT
POST METHOD
from web page
uploaded to server in entity body
URL METHOD
use GET method
uploaded in URL field of request line
METHOD TYPES
STATUS LINE: HTTP/1.0
POST
send data to server, create/update resource
HEAD
request header only, expect return
if URL request with HTTP GET method
use for debugging
GET
request data from resource
STATUS LINE: HTTP/1.1
PUT
upload file in entity body to path specific in URL
upload new file/object to server
replace file existed in URL, with entity body POST HTTP request
DELETE
delete file in URL
GET, POST, HEAD
2.2.3 HTTP RESPONSE STATUS CODE
appears in first line in server-to-client response
message (page 43)
2.2.4 USER-SERVER STATE: COOKIES
helps Web servers handle
thousands of simultaneous TCP connections
4 components
header line of HTTP responds messages
header line in next HTTP request message
file kept on user's host managed by user's browser
back-end db at web site
USES
authorization
shopping cart
recommendations
user session state on email
HOW TO KEEP "STATE"
protocol endpoints
maintain state at sender/receiver over multiple transactions
in messages
cookies in HTTP messages carry state
2.2.5 WEB CACHES (PROXY SERVER)
helps to limit the traffic
accepts client request without involve origin server
user configures (construct) browser to point to local -> creates web cache
browser sends all http to cache
IF object in cache -> cache returns object to client
ELSE cache requests object from origin server -> cache receives object -> return it to client
MORE ABOUT WEB CACHING
Web cache acts as both
client and server
typically ISP install cache
reduce response time for client request
cache easier/closer than origin server
reduce traffic on institution's access link
example: slim/fatteraccess link
Network Utilization
LAN Utilization = Traffic Intensity x 100%
Traffic Intensity = L.a/R
Access Link Utilization
Traffic Intensity = L.a/R
solution: instead of increasing access link rate
(which is not cheap), install local cache
LAN utilization still have the same rate
Access Link Utilization
hit rate
2.1 PRINCIPLE OF NETWORK APPLICATION
2.1.1 NETWORK APPLICATION ARCHITECTURES
Network architecture relates to 5 layers of
Internet architecture (network structure & logical layout)
(2.1.1) Application architecture sets the structure of application (patterns & techniques used to design/build app)
(2.1.1) Application structure
Client Server
ARCHITECTURE:
always on-host (server)
service a request to other host (client)
clients do not directly communicate to each other
server has fixed, well-known address (IP address)
client can always contact server by sending packet via IP address
e.g: email, web, Telnet, FTP
APPLICATION:
single-server host
incapable of keeping up request from client
e.g: popular social networking, data center (large number of host)
e.g: search engines, social networking, internet commerce,
web based email
Peer-to-Peer (P2P)
ARCHITECTURE
Does not rely on servers in data centers
App exploits direct communication
Pairing the hosts (connected) called peers
Peers does not own by service provider, but by desktops/laptops
Controlled by user
e.g: file sharing (BitTorrent), peer assisted download acceleration
Internet telephony
2.1.2 PROCESSES COMMUNICATING
(sends messages)
Processes on two different end systems communicate with each other by exchanging messages across
the computer network
ending process creates/sends messages into network;
receiving process receives these messages and possibly responds by sending messages back.
CLIENT-SERVER
Client process
process that
initiates communication
Server process
process that
waits to be contacted
applies on application with P2P architectures
SOCKET
Process sends/receives messages to/from its socket
The method
i) Socket sends process by push the message out to door
ii) Sending process relies on transport infrastructure on other
side of door to deliver message to socket at receiving process
iii) 2 sockets involved, one at each side (sending/receiving)
sends to TCP (controlled by OS, inside host/client server) connected to other TCP via Internet
controlled by application developer
ADDRESSING PROCESSES
(receives messages)
processes have identifiers to receive message
IDENTIFIER contains
IP address
32 bit size
Port number
Network application communicates/takes place between end system of application layer
(2.1.1) NETWORK APPLICATION ≠ APPLICATION ARCHITECTURE
2.1.3 APP LAYER PROTOCOL DEFINES
Many network uses more than one transport-layer protocol
Uses this protocol suits with the network it serves
4 dimensions
Throughput
related to timing, some require at certain speed
for its min requirement
Timing
e.g: games, video streaming, include graphic
Reliable data transfer
(data integrity)
e.g: data/file transfer, email
Security
transport protocol encrypt/decrypt data
rules for when and how processes send & respond to messages
2.1.4 INTERNET TRANSPORT PROTOCOL SERVICES
TCP service
TRANSPORT LAYER SERVICE (TLS)
provides encrypted TCP
connection
data integrity
end-point authentication
CHARACTERISTICS
reliable transport
flow control
congestion control
connection-oriented
does not provide
timing, minimum throughput
guarantee, security
UDP service
unreliable data transfer
does not provide
or connection setup,
throughput guarantee, security,
congestion control, timing,
reliability, flow control,
TCP & UDP
no encryption
2.3 FTP, EMAIL, DNS, P2P, CDN
2.3.1 FTP: FILE TRANSFER PROTOCOL
OVERVIEW
In FTP, user either transfer files to or from a remote host.
User to access the remote account, user must
provide a form of authentication – username and password.
After successful authorization -> user can transfer files from the
local file system to the remote file system and vice versa
FTP uses a client/server model
Server: remote host
Client: initiates transfer (either to/from remote)
FTP : runs on TCP
FTP : RFC 959
FTP server: port 21
Use 2 parallel TCP for file transfer from FTP client to FTP server
Control connection
To send control information
TCP Port 21
Data connection
For actual file transfer
TCP Port 20
PROCEDURE
i) client browse remote, sends commands to CC
ii) server receives file transfer command
III) opens DC to client using PORT 20
iv) after transfer (1 file) only then server close DC
v) CC remains open throughout session
vi) server opens another TCP data connection for another file transfer
FTP COMMANDS AND RESPONSE (IN SLIDE)
2.3.2 ELECTRONIC EMAIL
OVERVIEW
Asynchronous communication medium
User can send and read messages at their own convenience
Email: TCP
Email: PORT 25
Email: client-server method
Client: executes the sender’s mail server
Server: executes the recipient’s mail server
Mail server: can be client when it sends mail to other mail server
major components
user agents
a.k.a. “mail reader”
composing, editing, reading
mail messages
e.g: Microsoft Outlook, Apple Mail client
outgoing, incoming
messages stored on server
mail servers
mailbox
contains incoming messages for user
message queue
outgoing (to be sent) mail messages
the simple mail protocol (SMTP)
protocol for exchanging email messages between mail servers
PORT 25
TRANSFER
Direct Transfer
sending server to receiving server
Three phases of transfer
SMTP handshaking (greeting)
SMTP transfer of messages
SMTP closure
command/response interaction
like HTTP, FTP
commands: ASCII text (messages must be in 7-bit ASCII)
response: status code and phrase
uses persistent connections
protocol in slide
Mail access protocols
SMTP: Delivery/storage to receiver’
s server
MAP: retrieval from server
POP/POP3: Post Office Protocol: authorization,
download
extremely simple mail access protocol
Functionality is rather limited.
PROCEDURE:
i) POP3 begins when the user agent (the client) opens a TCP
connection to the mail server (the server) on port 110.
ii) POP3 goes through 3 phases:
a) Authorization: get username and password
b) Transaction: gets the email, delete email, etc
c) Update: server final update actions (like delete) after closing
iii) When the user agent issues commands, the server responds
with a reply (+OK or –ERR).
a) +OK: the previous command was fine
b) -ERR: something was wrong with the previous command.
Transaction Phase
list: list message numbers
retr: retrieve message by number
dele: delete
quit
MODES
download-and-delete mode
user agent gets mail from
mail server and deletes mail in server
download-and-keep mode
mail in server is not deleted
after downloading
POP3 is stateless across sessions
IMAP: Internet Mail Access Protocol
messages stored on server, IMAP provides retrieval, deletion, folders of stored messages on server
More complex, and has more features than POP3
Keeps all messages in one place: at server
Allows user to organize messages in folders
Keeps user state across sessions
has the ability to read part of the message
accommodate in low bandwidth connections
works well in a slow connection (e.g: modem)
HTTP: a protocol can be used to provide web-based interface on top of SMTP(to send), IMAP(or POP) to retrieve email messages
e-mail message is sent from recipient’s mail server to it’s browser: use HTTP protocol better than POP3 & IMAP
e.g hotmail
To send e-mail message: HTTP rather than
SMTP
2.3.3 DNS: DOMAIN NAME SYSTEM
OVERVIEW
DNS translates hostnames to IP addresses.
DNS protocol runs over UDP and uses port 53
an application-layer protocol that allows hosts to query the
distributed database to resolve names
distributed database implemented in a hierarchy of name
servers
commonly used by other application-layer
protocols—including HTTP, SMTP, and FTP
SERVICES
Hostname to IP address translation
Host aliasing
A complicated hostname (the canonical hostname) may have a
mnemonic (the alias hostname)
e.g: complicated hostname: relay1.west-coast.enterprise.com
its alias: enterprise.com or www.enterprise.com
Mail server aliasing
A simple email
(you@hotmail.com
) may actually have a more
complicated hostname (relay1.west-coast.hotmail.com).
Load distribution
Busy servers have load distribution
content distribution companies (e.g: Akamai) used DNS in more sophisticated ways
replicated Web servers
many IP addresses correspond to one name
DNS SERVERS
CLASS 1: ROOT DNS SERVERS
inside Internet -> 13 root DNS Server (A until M)
each server = a network of replicated server
incredibly important Internet function
DNSSEC – provides security (authentication, message integrity)
ICANN (Internet Corporation for Assigned Names and Numbers)
manages root DNS domain
ROOT NAME SERVER
i) contacts authoritative name server if name mapping not known
ii) gets mapping
iii) returns mapping to local name server
LOCAL NAME SERVER
“default name server”
each ISP has one
does not strictly belong to hierarchy
host -> DNS query -> local DNS server -> gets reply
DNS NAME RESOLUTION
ITERATIVE
the contacted server guides the clients to the next path
to take
RECURSIVE
the contacted name server resolves the name on the
clients behalf
C;ASS 2: TOP-LEVEL DOMAIN (TLD) DNS SERVER
responsible for top-level domains (com, org, net, edu, gov) &
country top-level domains ( uk, fr, ca, my, jp)
CLASS 3: AUTHORITATIVE DNS SERVER
organization DNS server – web server, mail server (e.g: cisco.com)
organization’s own DNS server, providing authoritative
hostname to IP mappings for organization’s named hosts
can be maintained by organization or service provider
DNS CACHING
to improve performance (reduce delay)
to reduce the number of DNS messages in the
Internet (save bandwidth)
when server learns mapping -> it caches mapping in local memory
cache entries disappear over time TTL
TLD cached in local name servers
root name server not often visited
DNS RECORD
stores different types of resource records (RR) used to
resolve names
RR Format: (Name, Value, Type, TTL)
Type=A - an end device address
Value: hostname's IP address
Type=NS - an authoritative name server
value: hostname of authoritative DNS that knows how to get IP address from hostname
Type= CNAME
value: canonical hostname (Fully Qualified Domain Name) for alias hostname Name
Type= MX
value: canonical name of mail server that has alias hostname Name
DNS SECURITY
DDOS ATTACKS
bombard root server with traffic
bombard TLD server
SPOOFING ATTACKS
intercept DNS queries, return reply: bogus
2.3.4 P2P & CDN
PEER-TO-PEER (P2P)
OVERVIEW
no always-on server
arbitrary (hit-or-miss) end systems directly
communicate
peers request service from other peers, provide service in return to other peers
self scalability
e.g: P2P file sharing (BitTorrent), streaming (KanKan),VoIP (Skype)
FILE DISTRIBUTION
CLIENT-SERVER
Server transmission
must sequentially upload N file copies
time to send one copy: F/us
time to send N copies: NF/us
N = the number of peers that the server service
(each needs a copy)
NF = the total transmitted bits to all peers
us: server upload capacity
di: peer i download capacity
ui: peer i upload capacity
client
each client must download
file copy
dmin = min client download rate
F/dmin = the minimum distribution time
min client download time: F/dmin
P2P
Server transmission
must upload
at least one copy
time to send one copy: F/us
F/us = the min distribution time for the client-server (at beginning)
Client
each client must download
file copy
min client download time:
F/dmin
Clients
as aggregate must download
NF bits
max upload rate (limiting max
download rate) is us + Σui
Σui = total upload rates of each of the individual peers
BITTORRENT
group of peers
exchanging chunks of a file
peer may change peers with whom it exchanges chunks
registers with tracker to get list, of peers, connects to subset of peers (“neighbors”)
once peer has entire file, it may (selfishly) leave or
(altruistically) remain in torrent
VIDEO STREAMING & CDN
OVERVIEW
stream video traffic: major consumer of Internet
bandwidth
video: sequence of images
displayed at constant rate
digital image: array of pixels (represented by bits)
coding: use redundancy within and between images to decrease # bits used to encode image
CBR: (constant bit rate):
video encoding rate fixed
VBR: (variable bit rate): video encoding rate changes as amount of spatial, temporal coding changes
spatial (within image)
temporal (from one image to
next)
Streaming multimedia: DASH
DASH: Dynamic, Adaptive Streaming over HTTP
SERVER
divides video file into multiple chunks
each chunk stored, encoded at different rates
MANIFEST FILE
provides URLs for different chunks
CLIENT
measures server-to-client bandwidth
consulting manifest, requests one chunk at a time
“intelligence” at client: client determines
when to request chunk
higher quality = more bandwidth
what encoding rate to request
request from URL server that close to client/
has high available bandwidth
where to request chunk
avoid buffer/overflow
CONTENT DISTRIBUTION NETWORK (CDN)
system of distributed servers (network)
deliver pages and other
Web content to a user
BASED ON:
geographic locations of the user
origin
of the webpage
content delivery server
ROLE: to enhance your regular hosting by
reducing bandwidth consumption
minimizing latency
providing the scalability
Servers in multiple geographic locations
TYPES
PRIVATE CDN
owned by content provider
e.g: Google, Youtube
A THIRD PARTY CDN
pay someone else to do it
e.g: Akamai, Limelight and
Level-3 all operate third-party CDNs
CDN replicates content across clusters (only the popular ones)
Clients request -> cluster retrieve -> cluster caches
-> cluster clears when cache is full
CDN PLACEMENTS
ENTER DEEP
get close to end users
Deploy server clusters in access ISP all over the world
improve user-perceived delay
and throughput
BRING HOME
get close to ISPs
lower maintenance and management
overhead
Deploy server clusters in IXP (Internet Xchange Point)
APPROACHES
Geographically closest
Real-time measurements
2.3.5 SOCKET PROGRAMMING
WITH TCP AND UDP
Learn how to build client/server applications that
communicate using sockets
socket: door between application process and end-end transport protocol
two transport service
UDP (unreliable datagram)
no “connection” between client & server
sender explicitly attaches IP destination address and port #
to each packet
receiver extracts sender IP address and port# from received
packet
transmitted data may be lost or received out-of-order
TCP (reliable, byte stream-oriented)
client must contact server
server process must first be
running
client contact server by:
Creating TCP socket,
specifying IP address,
port number of server process
server created doors to welcome client's contact
after have socket
client TCP established connection to server TCP
Server TCP creates new socket to communicate with particular client