(四)分布式系统-Communication

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调用的流程涉及到哪些通信细节:

  1. 服务消费方(client)调用以本地调用方式调用服务;
  2. client stub接收到调用后负责将方法、参数等组装成能够进行网络传输的消息体;
  3. client stub找到服务地址,并将消息发送到服务端;
  4. server stub收到消息后进行解码;
  5. server stub根据解码结果调用本地的服务;
  6. 本地服务执行并将结果返回给server stub;
  7. server stub将返回结果打包成消息并发送至消费方;
  8. client stub接收到消息,并进行解码;
  9. 服务消费方得到最终结果。

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

AMQP: Advanced Message Queueing Protocol

阅读:第 4 章 (pace.edu)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值