What is RPC? What did it?

RPC

Remote procedure call protocol. Request service from a remote computer through a network, do not care about the underlying network protocol technology. Briefly, RPC call to another machine (server) from a machine (the client) through parameter transfer process (service) and returns the obtained result.

What RPC done?

  • Determining the communication protocol between the client and server
  • Efficient network traffic (usually selected as the network communication frame Netty)
  • How the service provided by the server exposed to the client (zookeeper registration services)
  • How to find client service exposed (addressing find the service)
  • Request and response efficient serialization and deserialization (json, protobuf)

RPC implementation principle Chart

Description Composition

1, the client: service call ends

2, client stub: storing address information of the server, the client data is packed into a network message, and then sent to the server via the network transmission

3, server stub: extracting request message sent by the client, the server calls

4, the server: a real service provider

work process

  1. establish connection. Recommend long connection, the heartbeat periodically check whether the connection is still
  2. Addressing service. Registration service provider, the caller inquiries subscription service to the registry to the registry (zookeeper), the caller calling to find the IP and Port provider interface. Provider periodically sends heartbeat to the registry
  3. Network transmission data. Serialization and de-serialization
  4. Service call. The caller calls the provider interface to get return result, business processes

RPC framework mainstream What?

  • RMI
    • java achieve
  • Hession 
    • Based on http protocol, using binary coding
  • protobuf-rpc-pro   
    • java class libraries, Protocol Buffers based protocol, the underlying NIO Netty
  • Thrift
    • Support for multiple languages
  • Euro 
    • Cloud computing Protocol data exchange and storage, support for HTTP, TCP protocol
  • Dubbo
    • High-performance service framework     

 

Guess you like

Origin www.cnblogs.com/ivy-xu/p/12578707.html