The most important part in RPC is to obtain the service provider’s address. SOFARPC uses a service publishing and reference model, where SOFARegistry dynamically perceives service publishing and pushes the service address list to consumers that has referenced the service. At the same time, SOFARegistry updates the available service list in consumers’ local buffer and uses the load balancing algorithm to select an available address for remote communication.
SOFARegistry is an underlying component of the SOFA middleware and is used to store the address information of all service providers and the subscription information of all service consumers. It establishes persistent TCP connections with both service consumers and service providers to dynamically perceive changes in service release addresses and notify consumers of the changes.
The software load balancer (SLB) implements load balancing through software. When calling a service, a consumer selects (software load balancing) an address from the list pushed by SOFARegistry to the local cache, and calls the service provided at that address.
With the SOFARegistry, there is no need of hardcoded address in SOFARPC. Please see the following figure for the use of SOFARegistry in SOFARPC.