Lesson Dubbo architecture design

Overall architecture

Dubbo general architecture, as shown:

 


Dubbo frame design divided a total of 10 layers, while the top layer is left to the Service actually want to use the developer Dubbo development of distributed services implement business logic interface layer. The figure for the consumer to use the service interface, the right light green left light blue background interface for service providers to use the background, located in central axis used for both interfaces.
Now, in conjunction with Dubbo official documents, we were understanding about the framework layered architecture, the various levels of design points:

  1. Interface Layer Service (Service): This layer is associated with the actual business logic, according to a service provider and the service consumer interface design and implementation of services corresponding.

  2. Layer configuration (Config): External configuration interface to ServiceConfig ReferenceConfig center and can be directly new configuration class, the configuration may be arranged to generate class by parsing spring.

  3. Service proxy layer (Proxy): transparent proxy service interfaces, generating a service customer terminal and the server Skeleton Stub, in center ServiceProxy expansion interface ProxyFactory.

  4. Service registration layer (Registry): registration and discovery package service address, to serve as the center URL, extended interface is RegistryFactory, Registry and RegistryService. It may not be registered service center, the Service Provider directly exposed services.

  5. Cluster layer (Cluster): encapsulating a plurality of providers routing and load balancing, and bridging the registration center to center Invoker expansion interface Cluster, Directory, Router and LoadBalance. The combination of multiple service providers as a service provider, to achieve transparency of service consumers, providers only need to interact with a service.

  6. Monitoring layer (Monitor): RPC number of calls and call time monitoring to Statistics as the center, the expansion interface MonitorFactory, Monitor and MonitorService.

  7. Remote call level (Protocol): The RPC call letters to Invocation and Result for the center, the expansion interface Protocol, Invoker and Exporter. Protocol is a service domain, which is the main entrance features Invoker exposure and reference, which is responsible for the life cycle management of Invoker. Invoker is the entity domain, it is Dubbo's core model, other models are scrambling to rely on it, or convert it, it represents an executable body, can invoke call to initiate it, it is possible that a local implementation, it may is a remote implementation is also possible to achieve a cluster.

  8. Information exchange layer (Exchange): encapsulation request response mode, synchronous asynchronous transfer, to the center Request and Response, extended interface Exchanger, ExchangeChannel, ExchangeClient and ExchangeServer.

  9. Network transport layer (Transport): abstract mina and netty a unified interface for Message-centric, expansion interfaces for the Channel, Transporter, Client, Server and Codec.

  10. Data sequence layer (Serialize): some tools may be multiplexed, expansion interface Serialization, ObjectInput, ObjectOutput and ThreadPool.

As can be seen from the figure, Dubbo for service providers and the service consumer, the frame from the layer 10 to provide respective interfaces need care and extended, respectively, to build the entire ecosystem services (the service provider and the service consumer is itself a to serve as the center).
According to the official, the relationship between the respective layers described above, as follows:

  • In RPC, Protocol is the core layer, that is, as long as the Protocol + Invoker + Exporter can complete non-transparent RPC call, and then intercept point on the main course Invoker of Filter.

  • The figure of Consumer and Provider is an abstraction, just want Figure more intuitive understanding of what classes belong to the client and the server, not the cause of Client and Server are many scenes in Dubbo use Provider, Consumer, Registry, Monitor Top node partitioning logic to maintain a unified concept.

  • The Cluster is a peripheral concept, the Cluster aims to more disguised as a Invoker Invoker, so that other people can just focus Protocol layer Invoker, remove or add Cluster Cluster will not affect the other layers, since only one offer when who do not need the Cluster.

  • Proxy layer encapsulates all interfaces transparency agent, while in other layers to Invoker as the center, and only when exposed to the user, only with Proxy will Invoker turn into an interface, or interface turn into Invoker, i.e. remove Proxy Run the RPC layer can be, but not so transparent, less looks like a tune called up local service remote service.

  • The Remoting implementation is achieved Dubbo agreement, if you choose RMI protocol, will not spend the whole Remoting, internal Remoting then designated as the transport layer and Exchange Transport information exchange layer, Transport layer is responsible only for one-way message transmission, is Mina, Netty, Grizzly abstraction, it can also extend over UDP, and the Exchange layer above the transport layer encapsulates Request-Response semantics.

  • Registry Monitor and in fact not one, but an independent node, just to global overview draw together by way of layers.

From the above architecture diagram, we can see that, Dubbo as a distributed service framework, mainly has the following several core elements:

Service Definition
services provider and the service consumer about the services, service providers achieve service, but the service consumer invokes the service.

Registration service
provided for the service side, it needs to release service, and because of the complexity of the application system, the number of service types are also expanding; for the service consumer, it is most concerned about how to get to the service it needs, and face complex application system, need to manage a large number of service calls. Moreover, the service provider and the service consumer, they might as well both of these two roles, that is, both the need to provide services, there is a need consumer services.
By serving up unified management, can effectively optimize internal applications for service publish / use of processes and management. Service registry can be done outside of a unified service through a specific protocol. Registration centers have provided Dubbo to choose from the following types:

  • Multicast Registration Center

  • Zookeeper registry

  • Redis registry

  • Simple registration center

Service monitoring
whether the service provider or service consumer, they need the actual status of service calls for effective monitoring, thereby improving the quality of service.

- Telecommunications and information exchange
telecommunication specify a mutually agreed upon communications protocol, the communicating parties to ensure appreciated based on the protocol semantics, but also to ensure efficient and stable transmission of the message. Dubbo inherited the current mainstream network communications framework, mainly includes the following:

  • mine

  • Netty

  • Grizzly

Service call
following directly brought from Dubbo official website, look at the relationship between the parties provides calls and RPC-based consumer service layer, service, as shown:

 

 

Guess you like

Origin www.cnblogs.com/JiangWJ/p/10991141.html
Recommended