Learning notes — indirect communication

Time:2020-1-11

What is indirect communication?

Indirect communication is defined as communication between entities through intermediaries in a distributed system, without coupling between sender and receiver.

Indirect communication has two characteristics:
(1) Spatial decoupling: the sender does not need to know who the receiver is.
(2) Time decoupling: the sender and receiver can have independent lifecycles.

The paradigm of indirect communication

1. sets of communication

(1) concept
Group communication realizes multicast communication. Through one operation, messages are sent to all members of the group to communicate with all members of the system. An important feature of group communication is that a process item initiates a multicast operation, rather than multiple send operations to each process.

(2) classification
a. Closed and open groups
Closed group: for closed group members, only group members can multicast to it.
Development Group: for members of an open group, members outside the group can also multicast to it.

b. Overlapping and non overlapping groups
Overlapping groups: entities (objects or processes) can be members of multiple groups.
Non overlapping groups: entities (objects or processes) can belong to at most one group.

(3) implementation

Jgroups, etc.

2. Publish subscribe system

(1) concept

In the publish subscribe system, the publisher publishes events to the event service, and the subscriber expresses interest in specific events through subscription. The task of publish – subscribe system is to match the event of subscription and publish, and ensure the correct delivery of event notification. A given event is passed to multiple subscribers, so the publish subscribe system is a one to many communication paradigm.

Learning notes -- indirect communication

(2) Subscription model

a. Channel based

Publishers publish events to named channels, subscribers subscribe to one of the named channels, and receive all events sent to that channel.

b. Subject based

Each event notification can define multiple topics, and subscribers can subscribe according to the topics they are interested in.

c. Content based

Content based subscription is a generalization of topic based subscription.

d. Based on type

In an object-based method, an object has a specified type. In a type based approach, subscriptions are defined according to event types and given event types or subtypes.

(3) Architecture of publish subscribe system

Learning notes -- indirect communication

3. Message queue

(1) concept

The producer process sends messages to a specific queue, and the consumer process receives messages from the queue. There are three receiving methods:

a. Blocking reception: keep blocking until a suitable message is available.
b. Non blocking reception (polling): checks the flags of the queue, returns a message that is available, or an indication that it is not available.
c. Notification action: when a message is available in the queue, an event notification is sent to the consumer.

Learning notes -- indirect communication

(2) JMS (Java Message Service)

Learning notes -- indirect communication

4. Distributed shared memory

(1) concept

Distributed shared memory (DSM) is an abstraction used to share data with physical machines that do not share memory. Distributed shared memory enables processes of different computers to access data of different processes just as they access data of their own processes.

Learning notes -- indirect communication

(2) Comparison with messaging

Comparative content Distributed shared memory message passing
serialize Variables are shared directly by related processes and do not need to be serialized. Variables are serialized in the sending process and deserialized in the receiving process.
Safety The process sharing distributed memory may change the data incorrectly and cause other processes to fail. Processes that support messaging are protected because they have their own private address space.
Persistence Processes that communicate through DSM can take place in a non overlapping lifecycle. Processes that pass through messaging need to deliver messages at the same time.
synchronization Implemented by common components of shared memory programming, such as locks and semaphores. Synchronization between processes through message primitives.

(3) implementation

Apollo domain file system, etc.

5. Tuple space

(1) concept

Processes communicate indirectly by placing tuples in tuple space, and other processes can read or delete tuples from tuple space. A tuple consists of one or more data fields of type.

(2) implementation

JavaSpaces and so on.

Summary of indirect communication style

Comparative content group Publish subscribe system Message queue Distributed shared memory Space group communication
Spatial decoupling yes yes yes yes yes
Time Decoupling Probably Probably yes yes yes
Service style Communication based Communication based Communication based State based State based
Communication mode One to many One to many One-on-one One to many One to one or one to many
Main purpose Reliable distributed computing Information distribution or EAI; mobile and ubiquitous systems Information distribution or EAI; business transactions Parallel and distributed computing Parallel and distributed computing; mobile and ubiquitous systems
Scalability Limited Limited Probably Probably Limited
Relevance nothing Content based publish subscribe nothing nothing Yes

Reference materials

Distributed system concept and design

Recommended Today

[reading notes] calculation advertising (Part 3)

By logm This article was originally published at https://segmentfault.com/u/logm/articles and is not allowed to be reproduced~ If the mathematical formula in the article cannot be displayed correctly, please refer to: Tips for displaying the mathematical formula correctly This article isComputing advertising (Second Edition)Reading notes. This part introduces the key technology of online advertising, which is […]