320 likes | 548 Vues
Communication. Chapter 2. Part III Message-Oriented Communication. RPC, ROI, and Message Passing. RPC and ROI enhance access transparency by hiding communication RPC and ROI are inherently synchronous RPC and ROI are not always appropriate
E N D
Communication Chapter 2 Part III Message-Oriented Communication
RPC, ROI, and Message Passing • RPC and ROI enhance access transparency by hiding communication • RPC and ROI are inherently synchronous • RPC and ROI are not always appropriate • What if the receiving side I not executing when the request is sent • Sometimes, we need to resort to message-passing
Persistence and Synchronicity in Communication (1) 2-20 • General organization of a communication system in which hosts are connected through a network
Persistence and Synchronicity in Communication (2) • Persistent communication of letters back in the days of the Pony Express.
Persistence in Communication • Persistence: A (sent) message is stored by the communication system until it is delivered. • Transient: A (sent) message is stored by the communication system as long as both the sender and receiver applications are executing
Synchrony in Communication • Asynchronous: The sender does not block until the message is stored in a buffer at the: • Sending host, or • The first communication server • Synchronous: The sender blocks until the message : • Is stored in a buffer at the Receiving host, or • Delivered to to the receiver
Persistence Asynchronous Communication • A message is stored: • until delivered • at A’s host • at the first comm server • e.g.: email 2-22.1
Persistence Synchronous Communication • A message is stored: • until delivered • at the B’s host • weaker: stored at B’s • Comm server • stronger: delivered to B 2-22.1
Transient Asynchronous Communication • A message is stored: • at A’s host • at the first comm server • If B is not running, message • Is dropped • e.g.: UDP asynch. RPC 2-22.2
Transient Synchronous Communication (1) Weakest: Receipt-based Moderate: Delivery-based Strongest: Response-based 2-22.2
Transient Synchronous Communication (2) • Delivery-based transient synchronous communication at message delivery • Response-based transient synchronous communication
Message-Oriented Transient Communication • Berkley (UNIX) Sockets: • An abstraction of the actual communication endpoints • Message Passing Interface (MPI): • a standard for message passing • Makes hardware-independent applications • Short-term storage for messages • Seconds to milliseconds transfer time
Berkeley Sockets (1) Java Constructors accept() Constructor I/O streams close() • Socket primitives for TCP/IP.
Berkeley Sockets (2) ServerSocket() Socket() • Connection-oriented communication pattern using sockets.
MPI (1) • Processes are grouped (non-disjoint groups) • A process is identified by (groupID, processID) • Used instead of a transport-level address • Offers communication primitives for all kinds forms of communication • Except receipt-based transient synchronous communication
MPI (2) • Some of the most intuitive message-passing primitives of MPI.
Message-Oriented Persistent Communication • Message Queuing systems • Offers intermediate-term storage capacity for messages: • Without requiring any of the sender or receiver to be active during transmission • Intermediate-term: minutes of transfer time
Message-Queuing Model (1) • Applications communicate by inserting messages into queues • Each application has a private queue • Other applications send message to that queue • The private queue can be read only by the associated application • [Applications can share a queue] • A queue has a system-wide name (address)
Message-Queuing Model (2) • A messages travels through communication servers to get to its destination • It is popular to have direct connections between each pair of comm servers • Persistence: a message will eventually be inserted into the recipient’s queue
Loosely-Coupled Communication Sender Receiver Running Running Passive Passive • Receiver: not necessarily executing when the message is added to its queue • Sender: not necessarily executing when message is picked up by the receiver 4 execution modes while transmitting messages
Execution Modes 2-26 • Four combinations for loosely-coupled communications using queues.
Queuing System Interface • Basic interface to a queue in a message-queuing system.
General Architecture of a Message-Queuing System (1) A B Source Queue Destination Queue • Nearby the receiver • Message contains information about this queue • How the message travels between A and B is the responsibility of the queuing system • Nearby the sender • Messages can be put to the queue only
General Architecture of a Message-Queuing System (2) Queuing table entry Queue Name Network Address • The collection of queues is distributed across multiple machines • The system must maintain a (possibly distributed) database of queues (queuing tables)
General Architecture of a Message-Queuing System (3) • The relationship between queue-level addressing and network-level addressing.
General Architecture of a Message-Queuing System (4) • Queues are managed by queue managers • A queue manager interacts directly with the sending/receiving application • Some (special) queue managers act like routers or relays
General Architecture of a Message-Queuing System (5) 2-29 • Routing is static • Medium-level scalability (manually configure the routing tables)
Integrating Differing Message-Based Systems Message Broker A-specific message format System A System B B-specific message format
Message Brokers 2-30 • The general organization of a message broker in a message-queuing system.