CHAPTER 2
Jan 11, 2016
CHAPTER 2
Creating a network app
write programs that– run on (different) end systems– communicate over network– e.g., web server software
communicates with browser software
No need to write software for network-core devices– network-core devices do not
run user applications – applications on end systems
allows for rapid app development, propagation
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
Application 2-2
Application architectures
• client-server• peer-to-peer (P2P)• hybrid of client-server and P2P
Application 2-3
Client-server architectureserver:
– 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
client/server
Application 2-4
Pure P2P architecture
• no always-on server• arbitrary end systems
directly communicate• peers are intermittently
connected and change IP addresses
highly scalable but difficult to manage
peer-peer
Application 2-5
Hybrid of client-server and P2PSkype
– 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• user registers its IP address with central server
when it comes online• user contacts central server to find IP addresses of
buddies
Application 2-6
Processes communicatingprocess: program running
within a host.• within same host, two
processes communicate using inter-process communication (defined by OS).
• processes in different hosts communicate by exchanging messages
client process: process that initiates communication
server process: process that waits to be contacted
aside: applications with P2P architectures have client processes & server processes
Application 2-7
Addressing processes• to receive messages, process
must have identifier• host device has unique 32-bit
IP address• Q: does IP address of host
on which process runs suffice for identifying the process?
Application 2-8
Addressing processes• to receive messages,
process must have identifier
• host device has unique 32-bit IP address
• Q: does IP address of host on which process runs suffice for identifying the process?– A: No, many processes
can be running on same host
• identifier includes both IP address and port numbers associated with process on host.
• example port numbers:– HTTP server: 80– Mail server: 25
• to send HTTP message to gaia.cs.umass.edu web server:– IP address: 128.119.245.12– Port number: 80
• more shortly…
Application 2-9
App-layer protocol defines
• types of messages exchanged, – e.g., request, response
• message syntax:– what fields in messages &
how fields are delineated
• message semantics – meaning of information in
fields
• rules for when and how processes send & respond to messages
public-domain protocols:• defined in RFCs• allows for interoperability• e.g., HTTP, SMTPproprietary protocols:• e.g., Skype
Application 2-10
What transport service does an app need?
Data loss• some apps (e.g., audio) can
tolerate some loss• other apps (e.g., file transfer,
telnet) require 100% reliable data transfer
Timing• some apps (e.g., Internet
telephony, interactive games) require low delay to be “effective”
Throughput some apps (e.g., multimedia) require
minimum amount of throughput to be “effective”
other apps (“elastic apps”) make use of whatever throughput they get
Security encryption, data integrity, …
Application 2-11
Transport service requirements of common apps
Application
file transfere-mail
Web documentsreal-time audio/video
stored audio/videointeractive gamesinstant messaging
Data loss
no lossno lossno lossloss-tolerant
loss-tolerantloss-tolerantno loss
Throughput
elasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelastic
Time Sensitive
nononoyes, 100’s msec
yes, few secsyes, 100’s msecyes and no
Application 2-12
Internet transport protocols services
TCP service:• connection-oriented: setup
required between client and server processes
• reliable transport between sending and receiving process
• flow control: sender won’t overwhelm receiver
• congestion control: throttle sender when network overloaded
• does not provide: timing, minimum throughput guarantees, security
UDP service:• unreliable data transfer
between sending and receiving process
• does not provide: connection setup, reliability, flow control, congestion control, timing, throughput guarantee, or security
Q: why bother? Why is there a UDP?
Application 2-13
Cookies (continued)what cookies can bring:• authorization• shopping carts• recommendations• user session state (Web e-
mail)
cookies and privacy: cookies permit sites to learn a lot
about you you may supply name and e-mail
to sites
aside
how to keep “state”: protocol endpoints: maintain state at sender/receiver
over multiple transactions cookies: http messages carry state
Application 2-14
Web caches (proxy server)
• user sets browser: Web accesses via cache
• browser sends all HTTP requests to cache– object in cache: cache
returns object – else cache requests object
from origin server, then returns object to client
Goal: satisfy client request without involving origin server
client
Proxyserver
client
HTTP request
HTTP response
HTTP request HTTP request
origin server
origin server
HTTP response HTTP response
Application 2-15
More about Web caching
• cache acts as both client and server
• typically cache is installed by ISP (university, company, residential ISP)
why Web caching?• reduce response time for
client request• reduce traffic on an
institution’s access link.• Internet dense with caches:
enables “poor” content providers to effectively deliver content (but so does P2P file sharing)
Application 2-16
Caching example assumptions• average object size = 100,000 bits• avg. request rate from institution’s
browsers to origin servers = 15/sec• delay from institutional router to
any origin server and back to router = 2 sec
consequences• utilization on LAN = 15%• utilization on access link = 100%• total delay = Internet delay + access
delay + LAN delay = 2 sec + minutes + milliseconds
originservers
public Internet
institutionalnetwork 10 Mbps LAN
1.5 Mbps access link
institutionalcache
Application 2-17
Caching example (cont)possible solution• increase bandwidth of access link
to, say, 10 Mbpsconsequence• utilization on LAN = 15%• utilization on access link = 15%• Total delay = Internet delay +
access delay + LAN delay = 2 sec + msecs + msecs• often a costly upgrade
originservers
public Internet
institutionalnetwork 10 Mbps LAN
10 Mbps access link
institutionalcache
Application 2-18
Caching example (cont)possible solution: • install cache
consequence• suppose hit rate is 0.4
– 40% requests will be satisfied almost immediately
– 60% requests satisfied by origin server
• utilization of access link reduced to 60%, resulting in negligible delays (say 10 msec)
• total avg delay = Internet delay + access delay + LAN delay = .6*(2.01) secs + .4*milliseconds < 1.4 secs
originservers
public Internet
institutionalnetwork 10 Mbps LAN
1.5 Mbps access link
institutionalcache
Application 2-19
FTP: the file transfer protocol
• transfer file to/from remote host• client/server model
– client: side that initiates transfer (either to/from remote)– server: remote host
• ftp: RFC 959• ftp server: port 21
file transfer FTPserver
FTPuser
interface
FTPclient
local filesystem
remote filesystem
user at host
Application 2-20
FTP: separate control, data connections
• FTP client contacts FTP server at port 21, TCP is transport protocol
• client authorized over control connection
• client browses remote directory by sending commands over control connection.
• when server receives file transfer command, server opens 2nd TCP connection (for file) to client
• after transferring one file, server closes data connection.
FTPclient
FTPserver
TCP control connection,server port 21
TCP data connection,server port 20
server opens another TCP data connection to transfer another file.
control connection: “out of band” FTP server maintains “state”:
current directory, earlier authentication
Application 2-21
Electronic MailThree major components: • user agents • mail servers • simple mail transfer protocol:
SMTP
User Agent• a.k.a. “mail reader”• composing, editing, reading mail
messages• e.g., Outlook, elm, Mozilla
Thunderbird, iPhone mail client• outgoing, incoming messages
stored on server
user mailbox
outgoing message queue
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Application 2-22
Electronic Mail: mail servers
Mail Servers • mailbox contains incoming
messages for user• message queue of outgoing (to
be sent) mail messages• SMTP protocol between mail
servers to send email messages– client: sending mail server– “server”: receiving mail
server
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Application 2-23
DNS: Domain Name System
people: many identifiers:– SSN, name, passport #
Internet hosts, routers:– IP address (32 bit) - used
for addressing datagrams– “name”, e.g.,
www.yahoo.com - used by humans
Q: map between IP address and name, and vice versa ?
Domain Name System:• distributed database implemented
in hierarchy of many name servers• application-layer protocol host,
routers, name servers to communicate to resolve names (address/name translation)– note: core Internet function,
implemented as application-layer protocol
– complexity at network’s “edge”
Application 2-24
DNS Why not centralize DNS?• single point of failure• traffic volume• distant centralized database• maintenance
doesn’t scale!
DNS services• hostname to IP address
translation• host aliasing
– Canonical, alias names
• mail server aliasing• load distribution
– replicated Web servers: set of IP addresses for one canonical name
Application 2-25
Formulas
• Dcs = max { NR/Us , F/dmin }• N = Number of clients• Us= Upload capacity of server• F = file size• Dmin = minimum distribution time.
• Dp2p = max { F / Us , F / dmin, NF / us + i=1 to n ui}•
Problem 1
• P1: Consider distributing a file of F=10 Gbits to N peers. The server has an upload rate of Us = 20 Mbps and each peer has a download rate of di = 1 Mbps and upload rate of u. for N = 10, 100 and 1000 and u = 200 Kbps, 600 kbps and 1 Mbs, prepare a chart giving the minimum distribution time for each of the combination of N and u for both client server distribution and P2P distribution.