I. Interpretation of the duboo basic concept
Dubbo is a distributed service framework. Webservice is also a service framework, but webservice is not a distributed service framework, and he needs to balance loads with f5. Thus, in addition to the availability of services, dubbo can achieve a soft load balance. It also provides two functions, moNator control centre and call centre. The two are optional and need to be configured separately。
Dubbo's count structure is as follows:

We explain the following structure:
Consumer service consumers, provider service providers. Container service container. Consumption is, of course, the invoke provider, and the invoke line is, of course, synchronized according to the description on the map, adding that during the actual call, the position of provider is transparent for consumer, and the location of the last call (ip address) and the next call is uncertain. This place is a soft load。
The service provider starts the start and then registers the register service。
Consumers subscribe to subscribe services, and if they do not subscribe to services that they want, they continue to try to subscribe. When new services are registered in the register, the register will pass them to consumers through notify。
Monitor, this is a surveillanceNsumer and provider send messages by walk to monitor, consumer and provider store information on local disks, and on average 1min sends information once. Monitor is optional throughout the structure (the dotted lines in the chart are not optional) and the montor function needs to be configured separately, without configuration or configuration, and montor's hanging up does not affect service calls。
Ii. The dubbo doctrine
The content of this blog is generally abstract, and if a student who wants to use dubbo immediately does not read the blog very well, the blog does not write how to use and configure the dubbo, and then i ask him to write an introductory post containing the demo。
Details of the initialization process:
The first step in the chart above is to load the service in the container and then prepare the registration service. Similar to the start-up process in spring, when you load bean in the container, you first have to resolve the bean. So dubbo is also a first reading profile resolution service。
Parsing services:
1), based on m in dubbo. JarEta-inf/spring. Handlers configuration, spring returns to the dubbonamespacehandler category when you encounter the dubbo name space。
2) all dubbo labels are analyzed in dubbo bean defense parser, and xml labels are analyzed as bean objects based on a one-to-one attribute map。
Source:
Converts the bean object to the url format when serviceconfig. Export or referenceconfig. Get is initiated。
The url is then sent to the protocol extension point, the adaptive mechanism based on the extension point, where service exposures and references to different protocols are made in accordance with the head of the url agreement。
Exposure services:
A. Exposure service only
In the absence of a registered centre, this generally applies in the development environment, where the service is called and provided on the same ip, with only opening the service port。
I. E. When configure or
Serviceconfig solves the url format:
Dubbo
The adaptiver mechanism, based on the extension point, opens the service port by means of url's "dubbo://" protocol header recognition, directly calling dubboprotocol's export() method。
B. Exposure to registration centres:
The difference between ip and port of service need to be disclosed together to the registration centre。
Serviceconfig resolves the url format:
Registry@registry-host/com. Alibaba. Dubbo. Registryserviceexport=url. Encode (“dubbo://service-host/com. Xxx. Txserviversation=1. 0. 0” i'm not sure
The adaptive mechanism, based on the extension point, identified through the url's “registry://” protocol header, calling on the registryprotocol's export methodology, to first register the url of the supplier in the export parameters at the registration centre and then re-transmit it to the protocol extension point:
Dubbo
Reference services:
A. Direct reference services:
In the absence of a registered centre, the direct provider
Referenceconfig resolves the url format:
Dubbo
The adaptive mechanism, based on the extension point, is identified by the url's dubbo://() protocol header, directly calling dubboprotocol's refer method and returning the provider's reference。
B. Reference services found from the register:
At this point, the format of the url that the referenceconfig deciphered was:
Registry@registry-host/com. Alibaba. Dubbo. Registryservicerefer=url. Encode (“consumer://consuer-host/com. Foo. Fooserviversion=1. 0. 0” i'm not sure
Based on the extension-based apaptive mechanism, identified by url's “registry://” protocol header, registryprotocol's refer method is called upon, based on the overall condition of the refer parameters, to query the url of the provider, e. G.:
Dubbo
The adaptive mechanism based on the extension point, identified through the url's “dubbo://” protocol header, calls the dubboprotocol's refer() method and is quoted by the provider。
Registryprotocol then quotes multiple providers, using the cluster extension point, disguised as a single provider of this reference。
Remote call details:
Service providers exposed the detailed process of a service:

The above figure is the main process of exposure of service providers:
First, the serviceconfig class gets the actual type of ref for external service delivery, then the getinvoker method of proxyfactory uses ref to generate an example of abstractproxyinvoker, at which point the specific service is converted to invoker. And here's the transition from invoker to exporter。
The key to dubbo's exposure to treatment services is the process of conversion of invoker to exporter, which is illustrated below by the achievement of two typical agreements, dubbo and rmi:
Dubbo's realization:
The invoker conversion of the dubbo agreement to exporter, which took place in the dubboprotocol type of export method, mainly opened socket interception services and received various requests from the client, with the details of the communication being performed by dubbo itself。
Rmi achieves:
The rmi invoker conversion to exporter took place in the rmiprotocol type of export method, where he performed his services through spring or dubbo or jdk, and the communication details were obtained at the bottom of jdk。
Detailed process for consumer service consumption of a service

The above figure is the main process of service consumption:
First, the init method of the refenceconfig class calls for the refer method of protocol to generate examples of invoker. Now turn invoker into the interface that the client needs




