1. Layered Protocols
2. Types of Communication
Asynchronous versus synchronous communication
- 同步(synchronize)指用户进程触发IO操作等待或者轮训的方式查看IO操作是否就绪。
- 异步(asychronize)当一个异步进程调用发出之后,调用者不会立刻得到结果。而是在调用发出之后,被调用者通过状态、通知来通知调用者,或者通过回调函数来处理这个调用。
Transient versus persistent communication
Client/Server computing is generally based on a model of transient synchronous communication
Message-oriented middleware aims at high-level persistent asynchronous communication
3.Remote Procedure Call (RPC)
一个通俗的描述是:客户端在不知道调用细节的情况下,调用存在于远程计算机上的某个对象,就像调用本地应用程序中的对象一样。
RPC调用流程
要让网络通信细节对使用者透明,我们需要对通信细节进行封装,我们先看下一个RPC调用的流程涉及到哪些通信细节:
- 服务消费方(client)调用以本地调用方式调用服务;
- client stub接收到调用后负责将方法、参数等组装成能够进行网络传输的消息体;
- client stub找到服务地址,并将消息发送到服务端;
- server stub收到消息后进行解码;
- server stub根据解码结果调用本地的服务;
- 本地服务执行并将结果返回给server stub;
- server stub将返回结果打包成消息并发送至消费方;
- client stub接收到消息,并进行解码;
- 服务消费方得到最终结果。
Data Marshalling Issues
Asynchronous RPC
Remote Method Invocation (RMI) Operation
4. Message Oriented Middleware
-
Message Oriented Communication
Transient Messaging with Sockets
-
The Message-Passing Interface (MPI)
Advanced Transient Messaging
MPI是一种基于消息传递的编程模型,不同进程间通过消息交换数据。
-
Message Oriented Persistent Communication: Message-Queuing Model