16.MK-PPT Ch9
16.MK-PPT Ch9
16.MK-PPT Ch9
Chapter 9
Larry L. Peterson and Bruce S. Davie Problem
Applications need their own protocols.
Chapter 9 These applications are part network protocol (in
the sense that they exchange messages with
Applications
their peers on other machines) and part
traditional application program (in the sense that
they interact with the windowing system,
system the file
system, and ultimately, the user).
This chapter explores some of the most popular
network applications available today.
Chapter 9
Chapter 9
Chapter Outline Traditional Applications
Traditional Applications Two of the most popular
The World Wide Web and
Multimedia Applications
Email.
Infrastructure Services Broadly speaking, both of these applications use
Overlay Networks the request/reply paradigmusers send
req ests to servers,
requests ser ers which
hich then respond
accordingly.
3 4
Chapter 9
Chapter 9
5 6
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Electronic Mail (SMTP, MIME, IMAP) Electronic Mail (SMTP, MIME, IMAP)
Email is one of the oldest network applications Message Format
It is important RFC 822 defines messages to have two parts: a header and
a body. Both parts are represented in ASCII text.
(1) to distinguish the user interface (i.e., your mail
Originally, the body was assumed to be simple text. This is
reader) from the underlying message transfer still the case, although RFC 822 has been augmented by
protocols (such as SMTP or IMAP), and MIME to allow the message body to carry all sorts of data
data.
(2) to distinguish between this transfer protocol and a This data is still represented as ASCII text, but because it
companion protocol (RFC 822 and MIME) that defines may be an encoded version of, say, a JPEG image, its not
necessarily readable by human users.
the format of the messages being exchanged
The message header is a series of <CRLF>-terminated lines.
(<CRLF> stands for carriage-return+ line-feed, which are a
pair of ASCII control characters often used to indicate the end
of a line of text.)
7 8
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Electronic Mail (SMTP, MIME, IMAP) Electronic Mail (SMTP, MIME, IMAP)
Message Format Message Format
The header is separated from the message body by a blank MIME consists of three basic pieces.
line. Each header line contains a type and value separated by The first piece is a collection of header lines that augment the original
a colon. set defined by RFC 822.
These header lines describe, in various ways, the data being
Many of these header lines are familiar to users since they carried in the message body. They include MIME-Version: (the
are asked to fill them out when they compose an email version of MIME being used)
used), Content
Content-Description:
Description: (a human
human-
message. readable description of whats in the message, analogous to the
Subject: line), Content-Type: (the type of data contained in the
RFC 822 was extended in 1993 (and updated quite a few message), and Content-Transfer- Encoding (how the data in the
times since then) to allow email messages to carry many message body is encoded).
different types of data: audio, video, images, PDF documents, The second piece is definitions for a set of content types (and
and so on. subtypes). For example, MIME defines two different still image types,
denoted image/gif and image/jpeg, each with the obvious meaning.
The third piece is a way to encode the various data types so they can
be shipped in an ASCII email message.
9 10
Chapter 9
Chapter 9
11 12
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Electronic Mail (SMTP, MIME, IMAP) Electronic Mail (SMTP, MIME, IMAP)
Message Transfer Message Transfer
To place SMTP in the right context, we need to identify the While it is certainly possible that the MTA on a senders
key players. machine establishes an SMTP/TCP connection to the MTA
Second, there is a mail daemon (or process) running on each on the recipients mail server, in many cases the mail
host that holds a mailbox. traverses one or more mail gateways on its route from the
You can think of this process,
process also called a message transfer agent senders host to the receivers host.
(MTA), as playing the role of a post office: users (or their mail readers) Like the end hosts, these gateways also run a message
give the daemon messages they want to send to other users, the
daemon uses SMTP running over TCP to transmit the message to a
transfer agent process.
daemon running on another machine, and the daemon puts incoming Its not an accident that these intermediate nodes are called
messages into the users mailbox (where that users mail reader can gateways since their job is to store and forward email
later find it).
messages, much like an IP gateway (which we have
Since SMTP is a protocol that anyone could implement, in theory there
could be many different implementations of the mail daemon.
referred to as a router) stores and forwards IP datagrams.
13 14
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Electronic Mail (SMTP, MIME, IMAP) Electronic Mail (SMTP, MIME, IMAP)
Message Transfer (contd.) Mail Reader
The only difference is that a mail gateway typically buffers The final step is for the user to actually retrieve his or her
messages on disk and is willing to try retransmitting them to messages from the mailbox, read them, reply to them, and
the next machine for several days, while an IP router buffers possibly save a copy for future reference.
datagrams in memory and is only willing to retry transmitting The user performs all these actions by interacting with a mail
them for a fraction of a second. reader
reader.
As pointed out earlier, this reader was originally just a
program running on the same machine as the users mailbox,
in which case it could simply read and write the file that
implements the mailbox.
This was the common case in the pre-laptop era.
15 16
Chapter 9
Chapter 9
17 18
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Electronic Mail (SMTP, MIME, IMAP) World Wide Web
The World Wide Web has been so successful and has
made the Internet accessible to so many people that
sometimes it seems to be synonymous with the
Internet.
In fact, the design of the system that became the Web
started around 1989, long after the Internet had
become a widely deployed system.
The original goal of the Web was to find a way to
organize and retrieve information, drawing on ideas
about hypertextinterlinked documentsthat had
been around since at least the 1960s.
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
World Wide Web World Wide Web
The core idea of hypertext is that one document can Clearly, if you want to organize information into a
link to another document, and the protocol (HTTP) system of linked documents or objects, you need to
and document language (HTML) were designed to be able to retrieve one document to get started.
meet that goal. Hence, any Web browser has a function that allows
One helpful way to think of the Web is as a set of the user to obtain an object by opening a URL.
cooperating clients and servers, all of whom speak the URLs (Uniform Resource Locators) are so familiar to
same language: HTTP. most of us by now that its easy to forget that they
Most people are exposed to the Web through a havent been around forever.
graphical client program, or Web browser, like Safari, They provide information that allows objects on the
Chrome, Firefox or Internet Explorer. Web to be located, and they look like the following:
http://www.cs.princeton.edu/index.html
21 22
Chapter 9
Chapter 9
23 24
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
World Wide Web World Wide Web
Request Messages Request Messages
The first line of an HTTP request message specifies three
things: the operation to be performed, the Web page the
operation should be performed on, and the version of HTTP
being used.
Although HTTP defines a wide assortment of possible
request operationsincluding write operations that allow a
Web page to be posted on a serverthe two most common
operations are GET (fetch the specified Web page) and
HEAD (fetch status information about the specified Web
page).
HTTP request operations
25 26
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
World Wide Web World Wide Web
Response Messages Response Messages
Like request messages, response messages begin with a
single START LINE.
In this case, the line specifies the version of HTTP being
used, a three-digit code indicating whether or not the request
was successful
successful, and a text string giving the reason for the
response.
27 28
Chapter 9
Chapter 9
29 30
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
World Wide Web World Wide Web
TCP Connections TCP Connections
To overcome this situation, HTTP version 1.1 introduced
persistent connections the client and server can exchange
multiple request/response messages over the same TCP
connection.
Persistent connections have many advantages
advantages.
First, they obviously eliminate the connection setup overhead, thereby
reducing the load on the server, the load on the network caused by the
additional TCP packets, and the delay perceived by the user.
Second, because a client can send multiple request messages down a
single TCP connection, TCPs congestion window mechanism is able to
operate more efficiently.
This is because its not necessary to go through the slow start
phase for each page.
HTTP 1.0 behavior
31 32
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
World Wide Web World Wide Web
TCP Connections Caching
One of the most active areas of research (and
entrepreneurship) in the Internet today is how to effectively
cache Web pages.
Caching has many benefits. From the clients perspective, a
page that can be retrieved from a nearby cache can be
displayed much more quickly than if it has to be fetched from
across the world.
From the servers perspective, having a cache intercept and
satisfy a request reduces the load on the server.
33 34
Chapter 9
Chapter 9
35 36
30 October 2012
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Web Services Web Services
Increasingly such manual interactions are being Two architectures have been advocated as solutions
replaced with direct application-to application to this problem.
interaction. Both architectures are called Web Services, taking
An ordering application at enterprise A would send a their name from the term for the individual applications
message to an order fulfillment application at that offer a remotely-accessible service to client
enterprise B, which would respond immediately applications to form network applications.
indicating whether the order can be filled. The terms used as informal shorthand to distinguish
Perhaps, if the order cannot be filled by B, the the two Web Services architectures are SOAP and
application at A would immediately order from another REST (as in, the SOAP vs. REST debate).
supplier, or solicit bids from a collection of suppliers.
37 38
Chapter 9
Chapter 9
Traditional Applications Traditional Applications
Web Services Web Services
The SOAP architectures approach to the problem is The REST architectures approach to the problem is
to make it feasible, at least in theory, to generate to regard individual Web Services as World Wide Web
protocols that are customized to each network resourcesidentified by URIs and accessed via
application. HTTP.
The key elements of the approach are a framework for Essentially, the REST architecture is just the Web
protocol specification, software toolkits for architecture.
automatically generating protocol implementations The Web architectures strengths include stability and
from the specifications, and modular partial a demonstrated scalability (in the network-size sense).
specifications that can be reused across protocols.
39 40
Chapter 9
Chapter 9
41 42
30 October 2012
Chapter 9
Chapter 9
Multimedia Applications Multimedia Applications
The Resource Reservation Protocol, RSVP can Session Control and Call Control (SDP, SIP, H.323)
be used to request the allocation of resources in To understand some of the issues of session control, consider
the following problem.
the network so that the desired quality of service Suppose you want to hold a videoconference at a certain time and make it
(QoS) can be provided to an application. available to a wide number of participants. Perhaps you have decided to
encode the video stream using the MPEG-2 standard, to use the multicast IP
address 224.1.1.1 for transmission of the data, and to send it using RTP over
In addition to these protocols for multimedia UDP port number 4000.
transport and resource allocation
allocation, many How would you make all that information available to the intended
participants?
multimedia applications also need a signalling or One way would be to put all that information in an email and send it out, but
session control protocol. ideally there should be a standard format and protocol for disseminating this
sort of information.
For example, suppose that we wanted to be able
to make telephone calls across the internet
(voice over IP or VOIP).
43 44
Chapter 9
Chapter 9
Multimedia Applications Multimedia Applications
Session Control and Call Control (SDP, SIP, H.323) Session Description Protocol (SDP)
The IETF has defined protocols for just this purpose. The Session Description Protocol (SDP) is a rather general
The protocols that have been defined include protocol that can be used in a variety of situations and is typically
used in conjunction with one or more other protocols (e.g., SIP).
SDP (Session Description Protocol)
It conveys the following information:
SAP (Session Announcement Protocol) The name and purpose of the session
SIP (Session Initiation Protocol) Start and end times for the session
SCCP (Si
(Simple
l CConference
f C
Control
t lPProtocol)
t l) Th media
The di ttypes (e.g.
( audio,
di video)
id ) th
thatt comprise
i ththe session
i
Detailed information needed to receive the session (e.g. the multicast
address to which data will be sent, the transport protocol to be used, the port
numbers, the encoding scheme, etc.)
45 46
Chapter 9
Chapter 9
47 48
30 October 2012
Chapter 9
Chapter 9
Multimedia Applications Multimedia Applications
SIP SIP
Establishing communication
through SIP proxies. Message flow for a basic SIP session
49 50
Chapter 9
Chapter 9
Multimedia Applications Multimedia Applications
H.323 H.323
The ITU has also been very active in the call control area, which
is not surprising given its relevance to telephony, the traditional
realm of that body.
Fortunately, there has been considerable coordination between
the IETF and the ITU in this instance, so that the various
protocols are somewhat interoperable.
The major ITU recommendation for multimedia communication
over packet networks is known as H.323, which ties together
many other recommendations, including H.225 for call control.
The full set of recommendations covered by H.323 runs to many
hundreds of pages, and the protocol is known for its complexity
Devices in an H.323 network.
51 52
Chapter 9
Chapter 9
53 54
30 October 2012
Chapter 9
Chapter 9
Multimedia Applications Multimedia Applications
Resource Allocation for Multimedia Applications Resource Allocation for Multimedia Applications
Admission control using session control protocol. Co-ordination of SIP signalling and resource
reservationl.
55 56
Chapter 9
Chapter 9
Infrastructure Services Infrastructure Services
There are some protocols that are essential to the Name Service (DNS)
smooth running of the Internet, but that dont fit neatly In most of this book, we have been using addresses to identify
into the strictly layered model. hosts.
One of these is the Domain Name System (DNS)not While perfectly suited for processing by routers, addresses are
not exactly user-friendly.
an application that users normally invoke explicitly, but
It is for this reason that a unique name is also typically assigned
rather a service that almost all other applications depend to each host in a network.
upon. Host names differ from host addresses in two important ways.
This is because the name service is used to translate First, they are usually of variable length and mnemonic, thereby making them
easier for humans to remember.
host names into host addresses; the existence of such
Second, names typically contain no information that helps the network locate
an application allows the users of other applications to (route packets toward) the host.
refer to remote hosts by name rather than by address.
57 58
Chapter 9
Chapter 9
59 60
30 October 2012
Chapter 9
Chapter 9
Infrastructure Services Infrastructure Services
Domain Hierarchy Domain Hierarchy
DNS implements a hierarchical name space for Internet objects.
Unlike Unix file names, which are processed from left to right with
the naming components separated with slashes, DNS names are
processed from right to left and use periods as the separator.
Like the Unix file hierarchy, the DNS hierarchy can be visualized
as a tree, where each node in the tree corresponds to a domain,
andd th
the lleaves iin th
the ttree correspond
d tto th
the h
hosts
t bbeing
i named.
d
61 62
Chapter 9
Chapter 9
Infrastructure Services Infrastructure Services
Name Servers Name Servers
The complete domain name hierarchy exists only in the abstract. Each name server implements the zone information as a
We now turn our attention to the question of how this hierarchy is collection of resource records.
actually implemented. In essence, a resource record is a name-to-value binding, or
The first step is to partition the hierarchy into subtrees called more specifically a 5-tuple that contains the following fields:
zones. <Name, Value, Type, Class, TTL >
Each zone can be thought g of as corresponding
p g to some
administrative authority that is responsible for that portion of the
hierarchy.
For example, the top level of the hierarchy forms a zone that is
managed by the Internet Corporation for Assigned Names and
Numbers (ICANN).
63 64
Chapter 9
Chapter 9
65 66
30 October 2012
Chapter 9
Chapter 9
Infrastructure Services Infrastructure Services
Network Management Network Management
A network is a complex system, both in terms of the number of The most widely used protocol for this purpose is the Simple
nodes that are involved and in terms of the suite of protocols that Network Management Protocol (SNMP).
can be running on any one node. SNMP is essentially a specialized request/reply protocol that
Even if you restrict yourself to worrying about the nodes within a supports two kinds of request messages: GET and SET.
single administrative domain, such as a campus, there might be The former is used to retrieve a piece of state from some node,
dozens of routers and hundredsor even thousandsof hosts and the latter is used to store a new piece of state in some node.
t keep
to k track
t k of.f If you think
thi k about
b t allll the
th state
t t that
th t is
i maintained
i t i d SNMP is used in the obvious way.
and manipulated on any one of those nodesfor example, A system administrator interacts with a client program that displays
address translation tables, routing tables, TCP connection state, information about the network.
and so onthen it is easy to become depressed about the This client program usually has a graphical interface. Whenever the
prospect of having to manage all of this information administrator selects a certain piece of information that he or she wants to
see, the client program uses SNMP to request that information from the node
in question. (SNMP runs on top of UDP.)
An SNMP server running on that node receives the request, locates the
appropriate piece of information, and returns it to the client program, which
then displays it to the user.
67 68
Chapter 9
Chapter 9
Overlay Network Overlay Network
In the last few years, the distinction between packet However, overlay networks are quickly emerging as the
forwarding and application processing has become less mechanism of choice for introducing new functionality
clear. into the Internet
New applications are being distributed across the You can think of an overlay as a logical network
Internet, and in many cases, these applications make implemented on top of a some underlying network.
their own forwarding decisions. By this definition, the Internet started out as an overlay network
These new hybrid applications can sometimes be on top of the links provided by the old telephone network
implemented by extending traditional routers and Each node in the overlay also exists in the underlying
switches to support a modest amount of application- network; it processes and forwards packets in an
specific processing. application-specific way.
For example, so called level-7 switches sit in front of The links that connect the overlay nodes are
server clusters and forward HTTP requests to a specific implemented as tunnels through the underlying network.
server based on the requested URL.
69 70
Chapter 9
Chapter 9
71 72
30 October 2012
Chapter 9
Chapter 9
Overlay Network Overlay Network
Routing Overlays Routing Overlays
The simplest kind of overlay is one that exists purely Suppose, however, you wanted to use a routing
to support an alternative routing strategy; no algorithm that commercial router vendors were not
additional application-level processing is performed at willing to include in their products.
the overlay nodes. How would you go about doing it?
You can view a virtual private network as an example You could simply run your algorithm on a collection of end
of a routing overlay. hosts, and tunnel through the Internet routers.
In this particular case, the overlay is said to use IP These hosts would behave like routers in the overlay network:
as hosts they are probably connected to the Internet by only
tunnels, and the ability to utilize these VPNs is one physical link, but as a node in the overlay they would be
supported in many commercial routers. connected to multiple neighbors via tunnels.
73 74
Chapter 9
Chapter 9
Overlay Network Overlay Network
Routing Overlays Routing Overlays
Experimental Versions of IP End System Multicast
Overlays are ideal for deploying experimental versions of IP Although IP multicast is popular with researchers and certain
that you hope will eventually take over the world. segments of the networking community, its deployment in the
For example, IP multicast started off as an extension to IP global internet has been limited at best.
and even today is not enabled in many Internet routers. In response, multicast-based applications like
The Mbone (multicast backbone) was an overlay network that videoconferencing have recently turned to an alternative
implemented IP multicast on top of the unicast routing strategy, called end system multicast.
provided by the Internet. The idea of end system multicast is to accept that IP multicast
A number of multimedia conference tools were developed for will never become ubiquitous, and to instead let the end hosts
and deployed on the Mbone. that are participating in a particular multicast-based
For example, IETF meetingswhich are a week long and application implement their own multicast trees.
attract thousands of participantswere for many years
broadcast over the MBone.
75 76
Chapter 9
Chapter 9
77 78
30 October 2012
Chapter 9
Chapter 9
Overlay Network Overlay Network
Routing Overlays Resilient Overlay Networks
End System Multicast Another function that can be performed by an overlay
is to find alternative routes for traditional unicast
applications.
Such overlays exploit the observation that the triangle
inequality does not hold in the Internet
79 80
Chapter 9
Chapter 9
Overlay Network Overlay Network
Peer-to-peer Networks Peer-to-peer Networks
Music-sharing applications like Napster and KaZaA Whats interesting about peer-to-peer networks?
introduced the term peer-to-peer into the popular One answer is that both the process of locating an object of
vernacular. interest and the process of downloading that object onto your
local machine happen without your having to contact a
Attributes like decentralized and self- centralized authority, and at the same time, the system is
organizing are mentioned when discussing able to scale to millions of nodes.
peer-to-peer networks, meaning that individual A peer-to-peer system that can accomplish these two tasks in
a decentralized manner turns out to be an overlay network,
nodes organize themselves into a network where the nodes are those hosts that are willing to share
without any centralized coordination objects of interest (e.g., music and other assorted files), and
the links (tunnels) connecting these nodes represent the
sequence of machines that you have to visit to track down the
object you want.
81 82
Chapter 9
Chapter 9
83 84
30 October 2012
Chapter 9
Chapter 9
Overlay Network Overlay Network
Peer-to-peer Networks Peer-to-peer Networks
Structured Overlays Structured Overlays
At the same time file sharing systems have been fighting to fill If you think about what we are trying to do at a high level,
the void left by Napster, the research community has been there are two questions to consider:
exploring an alternative design for peer-to-peer networks. (1) how do we map objects onto nodes, and
We refer to these networks as structured, to contrast them (2) how do we route a request to the node that is responsible for a given
object.
with the essentially random (unstructured) way in which a
We start with the first question, which has a simple statement: how do
Gnutella network evolves. we map an object with name x into the address of some node n that is
Unstructured overlays like Gnutella employ trivial overlay able to serve that object?
construction and maintenance algorithms, but the best they While traditional peer-to-peer networks have no control over which node
can offer is unreliable, random search. hosts object x, if we could control how objects get distributed over the
network, we might be able to do a better job of finding those objects at a
In contrast, structured overlays are designed to conform to a later time.
particular graph structure that allows reliable and efficient
object location, in return for additional complexity during
overlay construction and maintenance..
85 86
Chapter 9
Chapter 9
Overlay Network Overlay Network
Peer-to-peer Networks Peer-to-peer Networks
Structured Overlays Structured Overlays
A well-known technique for mapping names into address is to
use a hash table, so that
hash(x) n
implies object x is first placed on node n, and at a later time, a
client trying to locate x would only have to perform the hash
of x to determine that it is on node n.
A hash-based approach has the nice property that it tends to
spread the objects evenly across the set of nodes, but
straightforward hashing algorithms suffer from a fatal flaw:
how many possible values of n should we allow?
Naively, we could decide that there are, say, 101 possible
hash values, and we use a modulo hash function; that is, Both nodes and objects map (hash) onto the id
hash(x) space, where objects are maintained at the nearest
return x % 101. node in this space.
87 88
Chapter 9
Chapter 9
Objects are located by routing through the peer-to- Adding a node to the network
peer overlay network.
89 90
30 October 2012
Chapter 9
Chapter 9
Overlay Network Overlay Network
Peer-to-peer Networks Peer-to-peer Networks
BitTorrent BitTorrent
BitTorrent is a peer-to-peer file sharing protocol devised by The beauty of BitTorrent is that replication is a natural side-
Bram Cohen. effect of the downloading process: as soon as a peer
It is based on replicating the file, or rather, replicating downloads a particular piece, it becomes another source for
segments of the file, which are called pieces. that piece.
Any particular piece can usually be downloaded from multiple The more p peers downloadinggp pieces of the file,, the more
peers, even if only one peer has the entire file. piece replication occurs, distributing the load proportionately,
The primary benefit of BitTorrents replication is avoiding the and the more total bandwidth is available to share the file with
bottleneck of having only one source for a file. This is others.
particularly useful when you consider that any given computer Pieces are downloaded in random order to avoid a situation
has a limited speed at which it can serve files over its uplink where peers find themselves lacking the same set of pieces.
to the Internet, often quite a low limit due to the asymmetric
nature of most broadband networks.
91 92
Chapter 9
Chapter 9
Overlay Network Overlay Network
Peer-to-peer Networks Peer-to-peer Networks
BitTorrent BitTorrent
Each file is shared via its own independent BitTorrent
network, called a swarm.(A swarm could potentially share a
set of files, but we describe the single file case for simplicity.)
The lifecycle of a typical swarm is as follows. The swarm
starts as a singleton
g p
peer with a complete
p copy
py of the file.
A node that wants to download the file joins the swarm,
becoming its second member, and begins downloading
pieces of the file from the original peer.
In doing so, it becomes another source for the pieces it
hasdownloaded, even if it has not yet downloaded the entire
file.
Peers in a BitTorrent swarm download from other peers
that may not yet have the complete file
93 94
Chapter 9
Chapter 9
95 96
30 October 2012
Chapter 9
Summary
We have discussed some of the popular applications in
the Internet
Electronic mail, World Wide Web
We have discussed multimedia applications
We have discussed infrastructure services
Domain Name Services (DNS)
We have discussed overlay networks
Routing overlay, End-system multicast, Peer-to-peer networks
We have discussed content distribution networks
97