Application Layer
Application Layer
CS F303
BITS Pilani Sanjay K. Sahay
Department of Computer Science and Information Systems
K K Birla Goa Campus
Module2 Lectures
Application Layer
Protocol layers
Client-server
Peer-to-peer (P2P)
Hybrid of P2P and Client Server Architecture
Process communication
Name, address and ports
Transport
clients:
communicate with server
client/server may be intermittently connected
may have dynamic IP addresses
do not communicate directly with
each other
Skype
voice-over-IP P2P application
centralized server: finding address of remote party:
client-client connection: direct (not through server)
Instant messaging
chatting between two users is P2P
centralized service: client presence detection/location
o user registers its IP address with central server when it comes
online
o user contacts central server to find IP addresses of buddy
application application
socket controlled by
process process app developer
transport transport
network network
link Internet link
physical physical
time
time
6. Steps 1-5 repeated for each of 10
jpeg objects
~
~ entity body ~
~ body
HTTP/1.0: HTTP/1.1:
GET GET, POST, HEAD
POST PUT
HEAD uploads file in entity
asks server to leave body to path specified
requested object out in URL field
of response DELETE
deletes file specified in
the URL field
above lets you send email without using email client (reader)
From:
Subject:
different from SMTP MAIL
FROM, RCPT TO:
commands!
Body: the message
ASCII characters only
BITS Pilani, K K Birla Goa Campus
Mail Access Protocols
user mail access user
SMTP SMTP protocol
agent agent
(e.g., POP,
IMAP)
cs.iitd.ac.in
cs.iitd.ac.in
type=A type=CNAME
name is hostname name is alias name for some
value is IP address canonical (the real) name
www.goa.bits-
type=NS pilani.ac.in.com is really
servereast.backup2.goa.bit
name is domain (e.g., s-pilani.ac.in
foo.com) value is canonical name
value is hostname of type=MX
authoritative name value is name of mailserver
server for this domain associated with name
examples:
file distribution
(BitTorrent)
VoIP (Skype)
time to distribute F
to N clients using
client-server approach
Dcs > max{NF/us,,F/dmin}
increases linearly in N
time to distribute F
to N clients using DP2P > max{F/us,,F/dmin,,NF/(us + ui)}
P2P approach
increases linearly in N
but so does this, as each peer brings service capacity
BITS Pilani, K K Birla Goa Campus
Client-Sever Vs. P2P: Example
client upload rate = u, F/u = 1 hour, us = 10u, dmin us
3.5
P2P
Minimum Distribution Time
3
Client-Server
2.5
1.5
0.5
0
0 5 10 15 20 25 30 35
Torrent File: A file containing information about the tracker, Object ID, and file
Seeds/Leechers : Peers that have complete/incomplete file.
Files are segmented into equal size chunk (256 kB)
BITS Pilani, K K Birla Goa Campus
P2P File Distribution: BitTorrent
peer joining torrent:
has no chunks, but will
accumulate them over time
from other peers
registers with tracker to get
list of peers, connects to
subset of peers
(neighbors)
v while downloading, peer uploads chunks to other peers
v peer may change peers with whom it exchanges chunks
v churn: peers may come and go
v once peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent
Hash table
DHT paradigm
Peer churn
12
60
13
48
25
40
32
overlay network
BITS Pilani, K K Birla Goa Campus
Resolving a Query
60
13
48
25
O(N) messages
on avgerage to resolve
query, when there 40
are N peers 32
13
48
25
40
32
each peer keeps track of IP addresses of predecessor,
successor, short cuts.
reduced from 6 to 3 messages.
possible to design shortcuts with O(log N) neighbors,
O(log N) messages in query
BITS Pilani, K K Birla Goa Campus
Peer Churn
1
handling peer churn:
3
vpeers may come and go (churn)
15
veach peer knows address of its two
4
successors
veach peer periodically pings its
12
5
two successors to check aliveness
vif immediate successor leaves, choose
10
next successor as new immediate
8
successor
example: peer 5 abruptly leaves