Rpc
- REMOTE PROCEDURE CALL: REPLACE COMMUNICATION VIA THE STACK WITH THE NETWORK
- A type of client/server communication
- Attempts to make remote procedure calls look like local ones
- problem:
- Calling and called procedures run on different machines, with different address spaces
- Must convert to local representation of data
- Machines and network can fail
- STUBS: OBTAINING TRANSPARENCY
- Client stub
- Marshalsargumentsintomachine-independentformat
- Sendsrequesttoserver
- Waits for response
- Unmarshals result and returns to caller
- Server stub
- Unmarshals arguments and builds stack frame
- Calls procedure
- Server stub marshals results and sends reply
- RFC makes a user defined header to a entire empty server library and user can filled them in.
- 写个接口让程序员调用服务器上的方法就像本地一样
- 通过编码和解码传输参数,遇到大小端的问题的话,可以采用语言将数据包装,这样就和地址顺序无关了。
- 存在的问题是:如果调用失败,可能是server或者网络的问题,无法排查。解决方式可以是在server保证最多一次request,出现第二次也返回第一次的reply
- 同步方法:1. 只进行一次rpc,允行完再ack 2. 两次rpc,收到请求ack,运行完ack