Communication Middleware Software Layers 1.1 A distributed system - - PowerPoint PPT Presentation

communication middleware software layers
SMART_READER_LITE
LIVE PREVIEW

Communication Middleware Software Layers 1.1 A distributed system - - PowerPoint PPT Presentation

Communication Middleware Software Layers 1.1 A distributed system organized as middleware. Note that the middleware layer extends over multiple machines. 2 Communication Alternatives Raw message passing TCP/IP: reliable byte stream


slide-1
SLIDE 1

Communication Middleware

slide-2
SLIDE 2

Software Layers

A distributed system organized as middleware. Note that the middleware layer extends over multiple machines. 1.1

2

slide-3
SLIDE 3

3

Communication Alternatives

฀ Raw message passing

฀ TCP/IP: reliable byte stream ฀ UDP/IP: unreliable, packet oriented, connectionless

Problem: low level --> not easy to use

฀ OS Abstractions: Distributed Shared Memory

Approach: on page fault, get the remote page Pros: easy to program. Cons: high overhead, hard to handle failures

slide-4
SLIDE 4

4

RPC (Xerox RPC)

n Remote Procedure Call (RPC)

฀ Main idea: Call remote procedures as if they are local ones. ฀ Key adv.: general, easy to use, and efficient. l

Uses the well-known procedure call semantics.

l

The caller makes a procedure call and then waits. If it is a local procedure call, then it is handled normally; if it is a remote procedure, then it is handled as a remote procedure call.

l

Caller semantics is blocked send; callee semantics is blocked receive to get the parameters and a nonblocked send at the end to transmit results.

slide-5
SLIDE 5

5

RPC Architecture

slide-6
SLIDE 6

6

Example

Interface{ // has enough information for compile time // checking, and generating proper calling sequence int func1(int arg) int func2(char * buffer, int size) }

slide-7
SLIDE 7

7

Example: Client stub

int func1(int arg)

Client stub for func1 int func1(int arg) {

Create req Pack table_index, fid, arg, …etc Send req Wait for reply Unpack results Return result

}

slide-8
SLIDE 8

8

Example: Server stub

int func1(int arg)

Server stub fun1{ Unpack request Find the requested function Call the function Pack results Send results }

slide-9
SLIDE 9

9

Example: How about fun2

Interface{ // has enough information for compile time // checking, and generate proper calling sequence int func1(int arg) int func2(char * buffer, int size) } Problems:

฀ *buffer points into different address space.

(solution: copy/restore if needed)

฀ Can be input or output

(solution: add an argument type (in|out|both)

฀ Complex data structures

slide-10
SLIDE 10

10

Binding

Example RPC-based file system Server Load function in memory Populate export table (fid, fname, call_back function) Export interface Registry Store s_ip, fname

function id (fid), unique id that is generated every time the function is exported

slide-11
SLIDE 11

11

Binding

Example: RPC-based file system Client Query registry Query server Store info in Memory (fname, server_ip, fid, index) Registry Server

Index Proc. Name fid call back pointer Export table

slide-12
SLIDE 12

12

Runtime

Client call fun1() Server Check export table Run function Return result

Runtime choices: TCP/IP?

  • High overhead on server, many connections and state
  • High latency (setting/closing connections)

UDP/IP

  • Unreliable. (used by Xerox RPC)

Index Proc. Name fid call back pointer Export table

slide-13
SLIDE 13

13

Fault tolerance

Lost request Client call fun1() Server Run function

time out

slide-14
SLIDE 14

14

Fault tolerance

Lost reply Client call fun1() Problem? function executed twice!! Server Run function Run function

time out

slide-15
SLIDE 15

15

Call semantics

฀ At least once: the function is executed at least once. ฀ At most once: the function is executed once or not at all

Neither one is perfect: exactly-once is desired but not possible with a single server RPC.

Xerox RPC implements, at most once semantic:

฀ If success is returned  exactly once: it is guaranteed that it

was executed exactly once

฀ On failure: at most once.

slide-16
SLIDE 16

16

Xerox at most once semantics

To avoid duplicates Client call fun1() Server Check export table Check prev. calls table Run function? Return result

(client ip, process ID, seq #, result) Strictly increasing sequence number

Unique processes id

client_ip

  • Proc. Id

Seq# Index Proc. Name fid call back pointer Export table

slide-17
SLIDE 17

17

Fault tolerance

Lost reply Client call fun1() Server Update the prev. call table Run function Check prev. calls tbl Duplicate, return without execution

time out client_ip

  • Proc. Id

Seq# IP1 22 10

slide-18
SLIDE 18

18

Fault tolerance

Client failure with repeated seq#? Client call fun1() Later call of fun1() Server Run function Check prev. calls tbl

  • >Duplicate, return

reboot

Fun1() was acked a second time without execution.

Solution: add clock based conversation id, to every call. <Conversation_id, seq#> is strictly increasing client_ip

  • Proc. Id

Seq# IP1 22 10

slide-19
SLIDE 19

19

Fault tolerance: Server crash

Client call fun1() Server Run function update prev. calls tbl Run function again !!

time out reboot Solution: Rebind on server restart with new fid client_ip

  • Proc. Id

Seq# IP1 22 10

slide-20
SLIDE 20

20

Fault tolerance: Server crash

Client call fun1() Server Run function Rebind functions with a different fid fid does not match

time out reboot What should the application do with this error?

slide-21
SLIDE 21

CS454/654 3-21

Message-Based Communication

฀ Lower-level interface to provide more flexibility ฀ Popular systems (RabbitMQ, ActiveMQ, Kafka) ฀ Two (abstract) primitives are used to implement these

send

receive

฀ Issues:

฀ Are primitives blocking or nonblocking (synchronous or asynchronous)? ฀ Are primitives reliable or unreliable (persistent or transient)?

slide-22
SLIDE 22

CS454/654 3-22

Message-Queuing System: P2P

The relationship between queue-level addressing and network-level addressing.

From Tanenbaum and van Steen, Distributed Systems: Principles and Paradigms

slide-23
SLIDE 23

CS454/654 3-23

Message Brokers

The general organization of a message broker in a message-queuing system.

2-30

From Tanenbaum and van Steen, Distributed Systems: Principles and Paradigms

slide-24
SLIDE 24

CS454/654 3-24

Message-Queuing System: flexible MQ network

2-29

From Tanenbaum and van Steen, Distributed Systems: Principles and Paradigms

slide-25
SLIDE 25

CS454/654 3-25

Synchronous/Asynchronous Messaging

฀ Synchronous

฀ The sender is blocked until its message is stored in the local buffer at the receiving host or

delivered to the receiver.

฀ Asynchronous

฀ The sender continues immediately after executing a send ฀ The message is stored in the local buffer at the sending host or at the first communication server.

slide-26
SLIDE 26

CS454/654 3-26

Transient/Persistent Messaging

฀ Transient

฀ The sender puts the message on the net and if it cannot be delivered to the sender or to the next

communication host, it is lost.

฀ There can be different types depending on whether it is asynchronous or synchronous

฀ Persistent

฀ The message is stored in the communication system as long as it takes to deliver the message to

the receiver