You are on page 1of 61

Chapter Four

Communication

11/06/2023 1
Objectives of the Chapter

• Review of how processes communicate in a network (the rules or the protocols) and their
structures

• Introduce most widely used communication models for distributed systems:


• Network Protocols and Standards
• Remote Procedure Call (RPC) -which hides the details of message passing and suitable for
client-server models
• Remote Object (Method) Invocation (RMI)
• Message-Oriented Middleware (MOM) -instead of the client-server model, think in terms of
messages and have a high level message queuing model similar to e-mail
• Stream-Oriented Communication -for multimedia to support the continuous flow of
messages with timing constraints
• Multicast Communication -information dissemination for several recipients.
• Web services - offering general services to remote applications without immediate interactions

11/06/2023from end users. 2


Network Protocols and Standards
 Why communication in distributed systems?
Because there is no shared memory
 Two communicating processes must agree on the syntax and semantics of
messages
 A protocol is a set of rules that governs data communications
 A protocol defines what is communicated, how it is communicated, and
when it is communicated
The key elements of a protocol are syntax, semantics, and timing
 Syntax: refers to the structure or format of the data
 Semantics: refers to the meaning of each section of bits
 Timing: refers to when data should be sent and how fast they can be sent

11/06/2023 3
 Two computers, possibly from different manufacturers, must be able to talk
to each other
 For such a communication, there has to be a standard
 The ISO OSI (Open Systems Interconnection) Reference Model is one of
such standards (7 layers )
 TCP/IP protocol suite is the other; has 4 or 5 layers
OSI
 Open – to connect open systems or systems that are open for communication
with other open systems using standard rules that govern the format, contents,
and meaning of the messages sent and received
 These rules are called protocols

Two types of transport layer protocols: connection-oriented and connectionless

11/06/2023 4
Lower-Level Protocols
The three lowest layers of the OSI protocol suite. Together, these
layers implement the basic functions that encompass a computer
network.
The physical layer
The data link layer
The Network layer

11/06/2023 5
a typical message as it appears on the network

11/06/2023 6
Transport Protocols: Client-Server TCP

Assuming no messages are lost,


 The client initiates a setup connection using

a three-way handshake (1-3)


 The client sends its request (4)

 It then sends a message to close the

connection (5)
 The server acknowledges receipt and

informs the client that the connection will


be closed down (6)
 Then sends the answer (7) followed by a

request to close the connection (8)


 The client responds with an ack to finish

conversation (9)

normal operation of TCP


11/06/2023 7
 Much of the overhead in TCP is for managing the connection
 Combine connection setup with request and
closing connection with answer
 Such protocol is called TCP for Transactions
(T/TCP)

 The client sends a single message consisting of a


setup request, service request, and information
to the server that the connection will be closed
down immediately after receiving the answer (1)
 The server sends acceptance of connection
request, the answer, and a connection release (2)
 The client acknowledges tear down of the
connection (3)

11/06/2023 transactional TCP 8


Higher- Level Protocols
 Above the transport layer, OSI distinguished three additional layers. In
practice, only the application layer is ever used. In fact, in the Internet
protocol suite, everything above the transport layer is grouped together.
 The session layer is essentially an enhanced version of the transport layer. It
provides dialog control, to keep track of which party is currently talking,
and it provides synchronization facilities.
 Unlike the lower layers, which are concerned with getting the bits from the
sender to the receiver reliably and efficiently, the presentation layer is
concerned with the meaning of the bits. Most messages do not consist of
random bit strings, but more structured information such as people's names,
addresses, amounts of money, and so on.
11/06/2023 9
Application Protocols
 File transfer (FTP - File Transfer Protocol)

 HTTP - Hypertext Transfer Protocol for accessing data on the WWW

Middleware Protocols
A middleware is an application that contains general-purpose protocols to
provide services
Example of middleware services
 Authentication and authorization services
 Distributed transactions (commit protocols; locking mechanisms)
 Middleware communication protocols (calling a procedure or
invoking an object remotely, synchronizing streams for real-time data,
multicast services)
Hence an adapted reference model for networked communications is
required

11/06/2023 10
 An adapted reference model for networked communication

11/06/2023 11
Remote Procedure Call
• The first distributed systems were based on explicit message
exchange between processes through the use of explicit send and
receive procedures; but do not allow access transparency
• In 1984, Birrel and Nelson introduced a different way of handling
communication: RPC
• It allows a program to call a procedure located on another machine
• Simple and elegant, but there are implementation problems
– The calling and called procedures run in different address spaces
– Parameters and results have to be exchanged;
– What if the machines are not identical?
– What happens if both machines crash?

11/06/2023 12
 Conventional Procedure Call, i.e., on a single machine
e.g. count = read (fd, buf, bytes); a C like statement, where
fd is an integer indicating a file
buf is an array of characters into which data are read
bytes is the number of bytes to be read
 Stack pointer

 Stack pointer

parameter passing in a local procedure the stack while the called procedure is
call: the stack before the call to read active

 Parameters can be call-by-value (fd and bytes) or call-by reference (buf) or in some
languages call-by-copy/restore

11/06/2023 13
 Client and Server Stubs
 RPC would like to make a remote procedure call look the same as a
local one; it should be transparent, i.e., the calling procedure
should not know that the called procedure is executing on a
different machine or vice versa

principle of RPC between a client and server program

when a program is compiled, it uses different versions of library


functions called client stubs
 a server stub is the server-side equivalent of a client stub

11/06/2023 14
 Steps of a Remote Procedure Call
1. Client procedure calls client stub in the normal way
2. Client stub builds a message and calls the local OS (packing parameters into
a message is called parameter marshaling)
3. Client's OS sends the message to the remote OS
4. Remote OS gives the message to the server stub
5. Server stub unpacks the parameters and calls the server
6. Server does the work and returns the result to the stub
7. Server stub packs it in a message and calls the local OS
8. Server's OS sends the message to the client's OS
9. Client's OS gives the message to the client stub
10. Stub unpacks the result and returns to client
 Hence, for the client remote services are accessed by making ordinary (local) procedure
calls; not by calling send and receive
11/06/2023 15
Parameter Passing

1. Passing Value Parameters


e.g., consider a remote procedure add(i, j), where i and j are integer parameters

Steps involved in doing remote computation through RPC 16


2. Passing Reference Parameters
 Assume the parameter is a pointer to an array
 Copy the array into the message and send it to the server
 The server stub can then call the server with a pointer to this array
 The server then makes any changes to the array and sends it back to the
client stub which copies it to the client
 This is in effect call-by-copy/restore
Optimization of the method
 One of the copy operations can be eliminated if the stub knows whether
the parameter is input or output to the server
 If it is an input to the server (e.g., in a call to write), it need not be copied
back
 If it is an output, it need not be sent over in the first place; only send the
size
 The above procedure can handle pointers to simple arrays and structures,
but difficult to generalize it to an arbitrary data structure

11/06/2023 17
Asynchronous RPC
 If there is no need to block the client until it gets a reply (two cases)
1. If there is no result to be returned
e.g., adding entries in a database, ...
The server immediately sends an ack promising that it will carryout
the request
The client can now proceed without blocking

a) The interconnection between client and server in a traditional RPC


b) The interaction using asynchronous RPC
11/06/2023 18
2. If the result can be collected later
 e.g., prefetching network addresses of a set of hosts, ...
 The server immediately sends an ack promising that it will carryout
the request
 The client can now proceed without blocking
 The server later sends the result

11/06/2023 a client and server interacting through two asynchronous RPCs 19


 The above method combines two asynchronous RPCs and is
sometimes called deferred synchronous RPC

Variants of asynchronous RPC


 Let the client continue without waiting even for an ack, called one-
way RPC
 Problem: if reliability of communication is not guaranteed

11/06/2023 20
RPC Programming Process
• Dividing the program into local and remote procedures.

 Proc A  RPC  Server Stub

 Client Stub  Proc B

11/06/2023 21
RPC Dispatching
(Procedure Location)

 Proc A2
 RPC
 Dispatcher
 Proc A1
 RPC  Server Stub  Server Stub

 Client Stub
 Client Stub  Proc B1  Proc B2

 11/06/2023  22
RPC Interface Specification

 Proc A  Server Comm


 RPC

 Client Iface  Server Iface

 Client comm  Proc B

 11/06/2023  23
RPC General Build Procedure

 Develop Interface

 Develop Client  Develop Server

 11/06/2023  24
Remote Object (Method) Invocation (RMI)
• Resulted from object-based technology that has proven its value in
developing non distributed applications
• it is an expansion of the RPC mechanisms
• it enhances distribution transparency as a consequence of an object that
hides its internal from the outside world by means of a well-defined
interface
Distributed Objects
– an object encapsulates data, called the state, and the operations on those
data, called methods
– methods are made available through interfaces
– the state of an object can be manipulated only by invoking methods
– this allows an interface to be placed on one machine while the object
itself resides on another machine; such an organization is referred to25as a
11/06/2023
 the state of an object is not distributed, only the interfaces are;
such objects are also referred to as remote objects
 the implementation of an object’s interface is called a proxy
(analogous to a client stub in RPC systems)
 it is loaded into the client’s address space when a client
binds to a distributed object
 tasks: a proxy marshals method invocation into messages
and unmarshals reply messages to return the result of the
method invocation to the client
 a server stub, called a skeleton, unmarshals messages and
marshals replies

11/06/2023 26
common organization of a remote object with client-side proxy

11/06/2023 27
 Binding a Client to an Object
 a process must first bind to an object before invoking its

methods, which results in a proxy being placed in the


process’s address space
 binding can be implicit (directly invoke methods using

only a reference to an object) or explicit (by calling a


special function)
 an object reference could contain

 network address of the machine where the object


resides
 endpoint of the server
 an identification of which object
 the protocol used
 ...

11/06/2023 28
 Parameter Passing
 there are two situations when invoking a method with
object reference as a parameter: the object can be local or
remote to the client
 local object: a copy of the object is passed; this means the
object is passed by value
 remote object: copy and pass the reference of the object
as a value parameter; this means the object is passed by
reference

11/06/2023 29
the situation when passing an object by reference or by value

 two examples:
 DCE Remote Objects

 Java RMI

Read R1: pages 93-98


11/06/2023 30
Message Oriented Communication

• RPCs and RMIs are not adequate for all distributed system
applications
• the provision of access transparency may be good but they have
semantics that is not adequate for all applications
• example problems
– they assume that the receiving side is running at the time
of communication
– a client is blocked until its request has been processed

11/06/2023 31
Persistence and Synchronicity in Communication
 assume the communication system is organized as a
computer network shown below

general organization of a communication system in which hosts are connected


11/06/2023
through a network 32
 communication can be
 persistent or transient
 asynchronous or synchronous
 persistent: a message that has been submitted for
transmission is stored by the communication system as long
as it takes to deliver it to the receiver
 e.g., email delivery, snail mail delivery

persistent communication of letters back in the days


of the Pony Express
11/06/2023 33
 transient: a message that has been submitted for
transmission is stored by the communication system only as
long as the sending and receiving applications are executing
 asynchronous: a sender continues immediately after it has
submitted its message for transmission
 synchronous: the sender is blocked until its message is
stored in a local buffer at the receiving host or delivered to the
receiver
 the different types of communication can be combined
 persistent asynchronous: e.g., email
 transient asynchronous: e.g., UDP, asynchronous RPC
 in general there are six possibilities

Persistent Transient

Asynchronous  

Synchronous  message-oriented; three forms

11/06/2023 34
persistent asynchronous  persistent synchronous
communication communication

11/06/2023 35
 transient asynchronous receipt-based transient synchronous
communication communication

 weakest form; the sender is


blocked until the message is
stored in a local buffer at the
receiving host
11/06/2023 36
 delivery-based transient response-based transient synchronous
synchronous communication communication
at message delivery
 the sender is blocked until the  strongest form; the sender is
message is delivered to the blocked until it receives a reply
receiver for further processing message from the receiver

11/06/2023 37
The Message-Passing Interface (MPI)
 sockets were designed to communicate across networks
using general-purpose protocol stacks such as TCP/IP
 they were not designed for proprietary protocols
developed for high-speed interconnection networks; of
course portability will suffer
 MPI is designed for parallel applications and tailored for
transient communication
 MPI assumes communication takes place within a known
group of processes, where each group is assigned an
identifier (groupID)
 each process within a group is also assigned an identifier
(processID)
 a (groupID, processID) identifies the source or destination
of a message, and is used instead of a transport-level
address

11/06/2023  38
Primitive Meaning
MPI_bsend Append outgoing message to a local send buffer
Send a message and wait until copied to local or remote
MPI_send
buffer
MPI_ssend Send a message and wait until receipt starts
MPI_sendrecv Send a message and wait for reply
MPI_isend Pass reference to outgoing message, and continue
Pass reference to outgoing message, and wait until receipt
MPI_issend
starts
MPI_recv Receive a message; block if there are none
MPI_irecv Check if there is an incoming message, but do not block

some of the most intuitive message-passing primitives of MPI

11/06/2023  39
Stream Oriented Communication
• until now, we focused on exchanging independent and complete units of
information
• time has no effect on correctness; a system can be slow or fast
• however, there are communications where time has a critical role
• Multimedia
– media
• storage, transmission, interchange, presentation, representation and
perception of different data types:
• text, graphics, images, voice, audio, video, animation, ...
• movie: video + audio + …
– multimedia: handling of a variety of representation media
– end user pull
• information overload and starvation
– technology push
• emerging technology to integrate media

11/06/2023 40
 The Challenge
 new applications
 multimedia will be pervasive in few years (as graphics)
 storage and transmission
 e.g., 2 hours uncompressed HDTV (1920×1080) movie:
1.12 TB (1920×1080x3x25x60x60x2)
 videos are extremely large, even after compressed
(actually encoded)
 continuous delivery
 e.g., 30 frames/s (NTSC), 25 frames/s (PAL) for video
 guaranteed Quality of Service
 admission control
 search
 can we look at 100… videos to find the proper one?
11/06/2023 41
 Types of Media
 two types
 discrete media: text, executable code, graphics, images;
temporal relationships between data items are not
fundamental to correctly interpret the data
 continuous media: video, audio, animation; temporal
relationships between data items are fundamental to
correctly interpret the data
 a data stream is a sequence of data units and can be applied
to discrete as well as continuous media
 stream-oriented communication provides facilities for the
exchange of time-dependent information (continuous media)
such as audio and video streams

11/06/2023 42
• timing in transmission modes
– asynchronous transmission mode: data items are transmitted one after the
other, but no timing constraints; e.g. text transfer
– synchronous transmission mode: a maximum end-to-end delay defined for
each data unit; it is possible that data can be transmitted faster than the
maximum delay, but not slower
– isochronous transmission mode: maximum and minimum end-to-end delay
are defined; also called bounded delay jitter; applicable for distributed
multimedia systems
• a continuous data stream can be simple or complex
– simple stream: consists of a single sequence of data; e.g., mono audio, video
only (only visual frames)
– complex stream: consists of several related simple streams that must be
synchronized; e.g., stereo audio, video consisting of audio and video (may
also contain subtitles, translation to other languages, ...)

11/06/2023 43
Unicast, Broadcast 


Key:
Unicast transfer

versus Multicast 


Broadcast transfer
Multicast transfer

• Unicast
– One-to-one
– Destination – unique receiver
host address
• Broadcast
– One-to-all
– Destination – address of
network
• Multicast
– One-to-many
– Multicast group must be
identified
– Destination – address of group

 11/06/2023  44
Multicast application examples

• Financial services
– Delivery of news, stock quotes, financial indices, etc

• Remote conferencing/e-learning
– Streaming audio and video to many participants
(clients, students)
– Interactive communication between participants

• Data distribution
– e.g., distribute experimental data from Large Hadron
Collider (LHC) at CERN lab to interested physicists around
the world

11/06/2023 45
Introduction to Web Services
• Microsoft coined the term “Web services” in June 2000, when
the company introduced Web services as a key component of
its .Net initiative,
– A new vision for embracing the Internet in the development,
engineering and use of software.
• As others began to investigate Web services, it became clear
that the technology could revolutionise distributed computing.
• Now, nearly every major vendor is marketing Web services’
tools and applications and Web services are radically changing
IT architectures and partner relationships.

 11/06/2023 46
• Web services encompass a set of related
standards that can allow any two computers to
communicate and exchange data via a network,
such as the Internet.
• The primary standard used in Web services is
the Extensible Markup Language (XML)
developed by the World Wide Web Consortium
(W3C).
• Developers use XML tags to describe individual
pieces of data, forming XML documents, which
are text-based and can be processed on any
 platform.
11/06/2023 47
• XML’s portability and its rapid adoption throughout the
industry made it the obvious choice for enabling cross-
platform data communication in Web services.
• XML provides the foundation for many core Web services
standards:
1. SOAP,
2. WSDL,
3. UDDI,
– Plus vocabularies of XML-based markup for a specific industry or
purpose).
• Almost every type of business can benefit from Web services
such as:
– Expediting software development,
– Integrating applications and databases,
– Automating transactions with suppliers, partners, and clients.

 11/06/2023 48
• SOAP (was originally called the Simple Object Access
Protocol) is an XML vocabulary that lets programs on
separate computers to interact across a network (via
RPC).
• WSDL (Web Services Description Language) is another
XML vocabulary that lets developers describe Web
services and their capabilities in a standardised format.
• UDDI (Universal Description, Discovery and Integration)
is a framework that defines XML-based registries where
businesses can publish information about themselves
and the services they offer.

 11/06/2023 49
Web Services’ Applications
• Unfortunately, interoperability, the ability to
communicate and share data with software from
different vendors and platforms, is limited among
conventional proprietary technologies, e.g. DCE,
CORBA, DCOM and RMI.
• Web services improve distributed computing
interoperability by using open (non-proprietary)
standards that can enable (theoretically) any two
software components to communicate:
– Also they are easier to debug because they are text-based,
rather than binary, communication protocols.

 11/06/2023 50
The Advantages of Web Services
• Web services advantages:
– Use open, text-based standards, which allow components written in
different languages and for different platforms to communicate,
– Promotes a modular approach to programming, so multiple
organisations can communicate with the same Web services.
– Comparatively easy and inexpensive to implement, because they
employ an existing infrastructure and because most applications can
be repackaged as Web services,
– Significantly reduce the costs of enterprise application integration
(EAI) and B2B communications,
– Implemented incrementally, rather than all at once which lessens the
cost and reduces the organisational disruption from an abrupt switch
in technologies,
– The Web Services Interoperability Organisation (WS-I) consisting of
over 100 vendors promotes interoperability.

 11/06/2023 51
Web Services’ challenges
• Web services’ challenges:
– The standards that drive Web services are still in
draft form, always will be in refinement.
– Some vendors want to retain their intellectual
property rights to certain Web services standards.
– Web services need standard security procedures,
a common problem to all of distributed
computing.
– The leading registry, based on the UDDI specification, has
some key limitations, and alternative discovery methods
are provided by ebXML and WS-Inspection.
– Web services need Quality of Service (QoS) support from
Web Services Registries, Brokerages, and Network
Providers.
 11/06/2023 52
Web Services Basics
• Web services:
– Software programs that use XML to exchange
information with other software via common
Internet protocols:
• Scalable, e.g. multiplying two numbers together to an
entire customer-relationship management system,
• Programmable - encapsulates a task,
• Based on XML - open, text-based standard,
• Self-describing - metadata for access and use,
• Discoverable - search and locate in registries,.

 11/06/2023 53
Architecture of Web Service
• A web service is a network accessible interface to
application functionality, built using standard
Internet technologies.
• Clients of web services do NOT need to know how
it is implemented.

 Application
 Application
 Network
 Web  code
 client  Service

11/06/2023 54
Web Services
1. Client queries registry to locate
 2
 WSDL service.
UDDI Docume 2. Registry refers client to WSDL
 Registry nt document.
3. Client accesses WSDL document.
4. WSDL provides data to interact with
 3 Web service.
 1
 4 5. Client sends SOAP-message request.
6. Web service returns SOAP-message
 5 response.
 Client
 Web
 6
 Services

 11/06/2023 55
Web Service Technology Stack
 shopping web service?

 Discovery
Discovery
 Web Service  WSDL URIs
  UDDI
 Client


 Description
Description  Web Service
WS

 WSDL
 SOAPDLpkg

 Packaging
Packaging request
 Proxy
 SOAP pkg
response

 Transport
Transport


 Network
Network

11/06/2023 56
Step1. Write Web Service Method
 shopping web service?

 Discovery
Discovery
 Web Service  WSDL URIs
  UDDI
 Client


 Description
Description  Web Service
WS

 WSDL
 SOAPDLpkg
 Packaging
Packaging

 Proxy request
 SOAP pkg
response

 Transport
Transport


 Network
Network

11/06/2023 57
Step2. Describe Web Service using WSDL
 shopping web service?

 Discovery
Discovery
 Web Service  WSDL URIs
  UDDI
 Client


 Description
Description  Web Service
WS

 WSDL
 SOAPDLpkg
 Packaging
Packaging

 Proxy request
 SOAP pkg
response

 Transport
Transport


 Network
Network

11/06/2023 58
Step3. Write Proxy to Access Web Service
 shopping web service?

 Discovery
Discovery
 Web Service  WSDL URIs
  UDDI
 Client


 Description
Description  Web Service
WS

 WSDL
 SOAPDLpkg
 Packaging
Packaging

 Proxy request
 SOAP pkg
response

 Transport
Transport


 Network
Network

11/06/2023 59
Step4. Write Client to Invoke Proxy
 shopping web service?

 Discovery
Discovery
 Web Service  WSDL URIs
  UDDI
 Client


 Description
Description  Web Service
WS

 WSDL
 SOAPDLpkg
 Packaging
Packaging

 Proxy request
 SOAP pkg
response

 Transport
Transport


 Network
Network

11/06/2023 60
SOAP (Simple Object Access Protocol)
• SOAP Messages
• Using SOAP as RPC (Remote Procedure Call)
Messages

 Request message

 SOAP client SOAP server

 Response message

* Read about Distributed Objects and Components


11/06/2023 61

You might also like