Multithreaded and distributed programming how distributed programs communicate
This presentation is the property of its rightful owner.
Sponsored Links
1 / 60

Multithreaded and Distributed Programming – How Distributed Programs Communicate PowerPoint PPT Presentation


  • 122 Views
  • Uploaded on
  • Presentation posted in: General

Multithreaded and Distributed Programming – How Distributed Programs Communicate. ECEN5053 Software Engineering of Distributed Systems University of Colorado. Distributed Systems – Concepts and Design, 3 rd ed. Coulouris, Dollimore and Kindberg, Addison-Wesley, 2001.

Download Presentation

Multithreaded and Distributed Programming – How Distributed Programs Communicate

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Multithreaded and distributed programming how distributed programs communicate

Multithreaded and Distributed Programming – How Distributed Programs Communicate

ECEN5053 Software Engineering of

Distributed Systems

University of Colorado

Distributed Systems – Concepts and Design, 3rd ed. Coulouris, Dollimore and Kindberg, Addison-Wesley, 2001


Examples of distributed systems

Examples of Distributed Systems

  • ATM

  • Web-based travel site

  • Stock transaction processing system

  • Search service


Multithreaded and distributed programming how distributed programs communicate

ATM

  • Client-server

  • Simple reply-response

  • Transactions required

  • Tightly controlled distributed system


Web based travel site

Web-Based Travel Site

  • Multi-tiered

    • Client

    • Travel site

    • Vendor reservation systems

    • Referred to as n-tiered

  • Organization responsible for site has little control over other tiers

  • Session-oriented


Stock transaction processing

Stock Transaction Processing

  • Peer-to-peer communication

  • Publish/subscribe model for many interactions


Google search service

Google Search Service

  • Language-neutral service

  • Easy to write program against

  • Freely available

  • Low support overhead


What they all need

What They All Need

  • Communication infrastructure

  • Remote references to objects and methods

  • Remote method invocation or remote procedure call


Special needs

Special Needs

  • Transactions

    • ATM

    • Stock transaction processing

  • Asynchronous Messaging

    • Stock transaction processing

  • Sessions

    • Travel site

  • Language neutrality – standard interfaces

    • Travel site

    • Stock transaction processing

    • Google search service


Special needs1

Special Needs

  • Transactions

    • ATM

    • Stock transaction processing

  • Asynchronous Messaging

    • Stock transaction processing

  • Sessions

    • Travel site

  • Language neutrality – standard interfaces

    • Travel site

    • Stock transaction processing

    • Google search service


Communication infrastructure

Communication Infrastructure


Synchronous communication

Synchronous communication

  • Remote procedure call (RPC)

  • Remote method invocation (RMI)

  • Client waits until server responds, or request times out

  • Most distributed processing falls into this model

  • Is much like normal, non-distributed programming, but…

    • Pass by reference is not practical

    • Not all data types may be available

    • Platform neutrality may be hard to achieve


Synchronous communication1

Synchronous communication

  • Remote procedure call (RPC)

  • Remote method invocation (RMI)

  • Client waits until server responds, or request times out

  • Most distributed processing falls into this model

  • Is much like normal, non-distributed programming, but…

    • Pass by reference is not practical

    • Not all data types may be available

    • Platform neutrality may be hard to achieve


Asynchronous communication

Asynchronous communication

  • Messaging

    • Client sends a message and moves on

    • If a response is needed, the client has a mechanism that listens for it

  • Point-to-point

  • Used in publish/subscribe applications, e.g.

  • Uses message-oriented middleware (MOM)


Asynchronous communication1

Asynchronous communication

  • Messaging

    • Client sends a message and moves on

    • If a response is needed, the client has a mechanism that listens for it

  • Point-to-point

  • Used in publish/subscribe applications, e.g.

  • Uses message-oriented middleware (MOM)


Messaging oriented middleware

Messaging-Oriented Middleware

  • IBM MQ Series

  • Oracle AQS

  • JMS – Java Messaging Service

    • Part of the J2EE standard

    • A set of standard interfaces, not a defined implementation

    • Many vendors provide JMS wrappers or adapters for their MOM


Messaging oriented middleware1

Messaging-Oriented Middleware

  • IBM MQ Series

  • Oracle AQS

  • JMS – Java Messaging Service

    • Part of the J2EE standard

    • A set of standard interfaces, not a defined implementation

    • Many vendors provide JMS wrappers or adapters for their MOM


External data representation

External Data Representation

  • Behavior vs State

    • An object’s behavior is defined independently of its identity

    • An object’s state is intimately associated with its identity

    • To send an object between remote processes, only its state needs to be transmitted

  • Marshalling and Unmarshalling

    • The mechanisms by which state is packaged for transmission, and unpackaged on the other end


External data representation1

External Data Representation

  • Behavior vs State

    • An object’s behavior is defined independently of its identity

    • An object’s state is intimately associated with its identity

    • To send an object between remote processes, only its state needs to be transmitted

  • Marshalling and Unmarshalling

    • The mechanisms by which state is packaged for transmission, and unpackaged on the other end


External data representation2

External Data Representation

  • Behavior vs State

    • An object’s behavior is defined independently of its identity

    • An object’s state is intimately associated with its identity

    • To send an object between remote processes, only its state needs to be transmitted

  • Marshalling and Unmarshalling

    • The mechanisms by which state is packaged for transmission, and unpackaged on the other end


Data representation issues

Data Representation Issues

  • Hardware specifics

    • Endian issues – how numbers are stored

  • OS specifics

    • Character sets

    • Integer sizes

  • Language specifics

    • String representations

    • Floating point number representations

    • Date/time representations

    • Object definitions


Data representation approaches

Data Representation Approaches

  • External representation is defined by the language (e.g., Java)

  • Sender marshalls to receiver’s representation

  • All processes subscribe to common, pre-compiled external representation (e.g., CORBA)

  • External representation is self-descriptive (e.g., XML, Web Services)


Data representation approaches1

Data Representation Approaches

  • External representation is defined by the language (e.g., Java)

  • Sender marshalls to receiver’s representation

  • All processes subscribe to common, pre-compiled external representation (e.g., CORBA)

  • External representation is self-descriptive (e.g., XML, Web Services)


Multithreaded and distributed programming how distributed programs communicate

Java

  • Marshalling and unmarshalling are built into the language

    • Called serialization and deserialization

  • Huge advantage: it’s part of the language

  • Only works for Java-to-Java

  • Encompasses a very wide range of Java types

  • Widely used in Java

    • Simple persistence

    • Distributed computing


Java cont

Java (cont.)

  • Referenced objects are also serialized

  • Redundant references and circularities are handled

  • Static attributes are not automatically serialized


Corba

CORBA

  • Object interfaces are defined in CORBA Interface Description Language (IDL)

  • CORBA interface compiler for a specific language/OS/platform creates code to marshall and unmarshall objects

  • Not all vendor’s CORBA tools are interoperable

  • Language neutrality has its costs…


Web services

Web Services

  • Uses Simple Object Access Protocol (SOAP) as common representation

  • SOAP is expressed in an XML dialect

  • All information is transmitted as strings

  • Uses HTTP as the request-reply protocol


Multithreaded and distributed programming how distributed programs communicate

XML

eXtensible Markup Language

  • Structured data in a text file

  • XML looks a bit like HTML but isn't HTML

  • XML is text, but isn't meant to be read

  • XML is new, but not that new

  • XML is not really a markup language itself, but a meta-language for defining markup languages

    • HTML can be defined using XML

    • Groups are attempting to define standard domain-specific XML dialects

    • Home-grown XML dialects are common for single applications, too


Why is xml a big deal

Why is XML a Big Deal?

  • Self-descriptive

  • Open standard

  • Platform and language neutral

  • License-free

  • Widely supported with free tools

  • A great way for applications to communicate with each other

  • The basis for a wide array of emerging technologies


Self descriptive data

Self-Descriptive Data

  • Consider data used in a pizza business to describe a pizza:

    • Style

    • Toppings

    • Size

    • Price

  • What do you think the following data record should mean?

“fishy”, 12, “cheese”, “anchovies”, 12.5


Self descriptive data cont

Self-Descriptive Data (cont.)

  • Is “12” an integer or a float?

  • Is “12.5” the size or the price?

  • If “12.5” were sent as a binary number, marshalling/unmarshalling would require knowledge of endpoint platforms

  • If the data came from a database, we need the database schema, and probably the database engine itself, to interpret the data.

  • If the data came from a file, we need to write code to interpret the data.

  • Adding or removing fields causes major problems.


Xml is self descriptive

XML is Self-Descriptive

  • Each datum is enclosed and tagged with a descriptor that tells us about its semantics

  • Possible XML representation for a pizza:

<pizza style=“fishy”>

<toppings>

<topping>cheese</topping>

<topping>anchovies</topping>

</toppings>

<size>12</size>

<price>12.5</price>

</pizza>


Xml is platform language neutral

XML is Platform & Language Neutral

  • Usually sent in a character format:

    • Usually ASCII Strings

    • Could be Unicode, although this is still less common

  • Documents are human-readable

  • Drawbacks

    • Uses more bytes than other representations

    • Documents can get hard to read

    • Writing documents can be error-prone

    • This format can be awkward when dealing with binary (non-character) data.

    • Binary data can be sent in encoded form, but the programs at either end of the conversation must understand the encoding.


Xml schema

XML Schema

  • Schema documents define the structure and semantics of an XML dialect

  • People who want to define an XML dialect (say for standard medical records), would define a schema


Distributed objects

Distributed Objects


Multithreaded and distributed programming how distributed programs communicate

ATM

  • ATM “Teller” object works with Account object

  • Teller object is local to the ATM

  • Account object is in some process back at the bank

  • How do they talk to each other?


Talking to remote objects

Talking to Remote Objects

  • Finding the object you want

  • Getting a reference to the object

  • Invoking methods on the object

  • Receiving results

  • Differences from talking to local objects


Finding the object you want

Finding The Object You Want

  • Requires a naming or directory service

  • Finding hosts on the Internet – Domain Name System (DNS)

    • You give it a URL

    • DNS gives you an IP address


Getting the object you want

Getting The Object You Want

  • Ask the server that has the object to send it to you

    • Identify it by some sort of key

  • The server sends you a proxy or stub

  • The stub supports the same interface as the actual remote object


Getting the object you want1

Getting The Object You Want

  • Ask the server that has the object to send it to you

    • Identify it by some sort of key

  • The server sends you a proxy or stub

  • The stub supports the same interface as the actual remote object


Invoking methods on the object

Invoking Methods on the Object

  • Client talks to the stub

  • Stub’s job

    • Specifies the method to execute

    • Marshalls the parameters

    • Sends method ID and parameters to the skeleton

  • Skeleton’s job

    • Unmarshalls parameters

    • Calls the actual object


Receiving results

Receiving Results

  • Skeleton’s job

    • Receives results from the actual object

    • Marshalls the results

    • Sends results to the stub

  • Stub’s job

    • Unmarshalls the results

    • Passes them back to the client


Web based travel site1

Web-Based Travel Site

  • The site must maintain a shopping cart for the client, remember his preferences, etc.

  • One remote service, the site, must collaborate with several other remote services, the airline and hotel reservation systems

  • How does the site avoid treating each as a special case?

  • How does the site perform adequately?


Maintaining a shopping session

Maintaining a Shopping Session

  • Http is a stateless protocol

  • Session state must be implemented somehow

    • Cookies

      • Hunks of information the server leaves on the client machine

    • URL rewriting

      • Session information is encoded in the URL string sent between the client and server


Talking to distributed databases

Talking to Distributed Databases

  • N-tier architecture

    • Client

    • Web Server

    • Application server

    • Database server

  • Use standard database abstractions

    • Connections

    • ODBC and JDBC


Talking to distributed databases1

Talking to Distributed Databases

  • N-tier architecture

    • Client

    • Web Server

    • Application server

    • Database server

  • Use standard database abstractions

    • Connections

    • ODBC and JDBC


Stock transaction processing system

Stock Transaction Processing System

  • Client processes must be able to subscribe to trades and changes in price of specific securities

  • Subscriptions are maintained when client or server system is restarted

  • If client is not running, notices to which it subscribes are saved for it

  • System sends asynchronous notices to subscribers

  • How does the client know what happens without poling?


Messaging

Messaging

  • Asynchronous interaction between clients and servers

  • Messages are passed between them on queues

  • Queues are provided by message-oriented middleware

  • Producers put message on queues

  • Consumers get messages off queues

    • Can poll for messages (not common)

    • Can be notified when messages arrive

      • Assign listeners to the queue


Messaging1

Messaging

  • Asynchronous interaction between clients and servers

  • Messages are passed between them on queues

  • Queues are provided by message-oriented middleware

  • Producers put message on queues

  • Consumers get messages off queues

    • Can poll for messages (not common)

    • Can be notified when messages arrive

      • Assign listeners to the queue


Messaging cont

Messaging (cont.)

  • Durable subscriptions

    • If the receiver is not running, the queue will deliver the messages when the receiver comes back

  • Persistent queues

    • All messages that are put on the queue are also saved to a database

  • Listeners

    • Methods that wait to receive messages from queues

    • Separate thread owned by the receiver process

    • When a message arrives, the listener is “woken up”


Messaging point to point

Messaging – Point to Point

  • One consumer

    • Usually owns the queue

  • Many producers

  • Process that wants to send a message to the receiver puts a message on the receivers input queue


Messaging publish subscribe

Messaging – Publish/Subscribe

  • One or more producer

    • One of them, or central service, owns the queue

  • Many consumers

  • Consumers subscribe to topic queues

    • Consumer is usually not interested in every message published on the topic queue

    • Specifies filters on messages

    • Specify the local listener to call when a qualifying message is published


Messaging publish subscribe1

Messaging – Publish/Subscribe

  • One or more producer

    • One of them, or central service, owns the queue

  • Many consumers

  • Consumers subscribe to topic queues

    • Consumer is usually not interested in every message published on the topic queue

    • Specifies filters on messages

    • Specify the local listener to call when a qualifying message is published


Google search service1

Google Search Service

  • Must be easy to program clients for

  • Clients can be written in one of many languages

  • Low support overhead for Google

  • How do you make the service simple, easy, and universal?


Web services1

Web Services

  • Finding Services - UDDI

  • Describing Services - WSDL

  • Invoking Services – SOAP

  • Both RPC and messaging


Finding services uddi

Finding Services - UDDI

  • Universal Description, Discovery and Integration

  • A way for clients to find web services

  • Not being used very much, yet


Describing services wsdl

Describing Services - WSDL

  • Web Services Definition Language

  • A language for defining the interfaces for a web service

    • Names of methods

    • Types and order of parameters

    • Types of return values

    • URL of service

  • Writing WSDL

    • Do it once, when service is defined

    • Annoying and error-prone to do by hand

    • Several free generating packages available

      • GLUE (The Mind Electric)

      • IBM Web Services Toolkit (IBM Alphaworks)


Invoking services soap

Invoking Services - SOAP

  • Simple Object Access Protocol

  • Runs over HTTP

  • Defines how objects are passed back and forth

  • Writing SOAP

    • Do it every time a service is requested

    • REALLY annoying and error-prone to write by hand

    • Good tools are available

      • Apache SOAP

      • AXIS

      • Visual Studio .NET


Invoking services soap1

Invoking Services - SOAP

  • Simple Object Access Protocol

  • Runs over HTTP

  • Defines how objects are passed back and forth

  • Writing SOAP

    • Do it every time a service is requested

    • REALLY annoying and error-prone to write by hand

    • Good tools are available

      • Apache SOAP

      • AXIS

      • Visual Studio .NET


Web services reading list

Web Services Reading List

  • http://www.oreillynet.com/pub/a/webservices/2002/04/12/execreport.html

    • A brief, high-level overview of some of the important business motivations for web services.

  • http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicefaqs.html

    • A overview of the technologies involved in web services, and why they make web services different from other distributed computing technologies.

  • http://www.xml.com/pub/a/2002/04/24/taglines.html

    • An interesting and opinionated editorial that raises some of the important political and business-related issues around web services, XML and the Internet.


Comments on homework

Comments on homework

What kinds of clients

What kinds of servers

exchange

data base

messaging

What kinds of interfaces

putting something up for auction

submitting bids

ask questions about what’s going on


  • Login