Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the core function of Dubbo

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "what is the core function of Dubbo". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

What is 1.Dubbo?

Dubbo is a distributed, high-performance and transparent RPC service framework, which provides efficient service governance solutions such as automatic service registration and automatic discovery, and can be seamlessly integrated with the Spring framework.

RPC refers to the remote invocation protocol, which means that two servers exchange data.

The origin of 2.Dubbo?

With the rapid development of the Internet, the scale of Web applications continues to expand, which generally goes through the following four stages of development.

Single application architecture

When the website traffic is very small, only one application is needed to deploy all the functions together.

Vertical application architecture

When the number of visits increases gradually, a single application is divided into multiple applications according to the business line to improve efficiency.

At this point, the Web framework (MVC) used to accelerate front-end page development is the key.

Distributed service architecture

When there are more and more vertical applications, the interaction between applications is inevitable, the core business will be extracted as an independent service, and gradually form a stable service center, so that the front-end applications can respond to the changing market demand more quickly.

At this point, the distributed service framework (RPC) for improving business reuse and integration is the key.

Mobile computing architecture

When there are more and more services, the evaluation of capacity and the waste of small service resources gradually appear, so it is necessary to add a scheduling center to manage cluster capacity in real time based on access pressure to improve cluster utilization.

At this point, the resource scheduling and governance center (SOA) used to improve machine utilization is the key.

What are the main application scenarios of 3.Dubbo?

Transparent remote method invocation, calling remote methods as if they were local methods, with simple configuration without any API intrusion.

Soft load balancing and fault-tolerant mechanism can replace F5 and other hardware load balancers in the intranet to reduce costs and reduce a single point.

Automatic service registration and discovery eliminates the need to write down the address of the service provider. The registry queries the IP address of the service provider based on the interface name, and can smoothly add or delete service providers.

What are the core functions of 4.Dubbo?

The main functions are as follows:

Remoting: network communication framework that provides abstract encapsulation of a variety of NIO frameworks, including "synchronous to asynchronous" and "request-response" modes of information exchange.

Cluster: service framework that provides transparent remote procedure calls based on interface methods, including multi-protocol support, as well as soft load balancing, failure tolerance, address routing, dynamic configuration and other cluster support.

Registry: service registration, based on the registry directory service, enables the service consumer to dynamically find the service provider, makes the address transparent, and enables the service provider to smoothly add or decrease machines.

The core components of 5.Dubbo?

The process of 6.Dubbo service registration and discovery?

Process description:

Provider (provider) binds the specified port and starts the service

Means that the supplier connects to the registry and sends native IP, port, application information and service information to the registry for storage.

Consumer (consumer), connect to the registry, and send application information and requested service information to the registry.

The registry matches the corresponding list of providers according to the service information requested by the consumer and sends it to the Consumer application cache.

Consumer initiates a call based on a cached consumer list when it initiates a remote call.

Provider status changes will be notified to the registry in real time and pushed to Consumer in real time by the registry

Reasons for the design:

When Consumer and Provider are decoupled, both sides can increase or decrease the number of nodes horizontally.

The registry can be a peer-to-peer cluster for itself, which can dynamically add or decrease nodes, and when any one is down, it will automatically switch to the other.

Decentralization, both sides do not directly rely on the lazy registry, even if the registry is down for a short time, it will not affect the invocation of the service.

The service provider is stateless, and its use will not be affected when any one of them goes down.

Image

What is the architecture of 7.Dubbo?

The Dubbo framework design is divided into 10 layers:

Service Interface layer (Service): this layer is related to the actual business logic, and the corresponding interfaces and implementations are designed according to the business of the service provider and service consumer.

Configuration layer (Config): configure interfaces externally, centering on ServiceConfig and ReferenceConfig.

Service proxy layer (Proxy): transparent proxy of the service interface, generating client-side Stub and server-side Skeleton of the service.

Service Registration layer (Registry): encapsulates the registration and discovery of service addresses, focusing on the service URL.

Cluster layer (Cluster): encapsulates the routing and load balancing of multiple providers, and bridges the registry, centering on Invoker.

Monitoring layer (Monitor): monitoring the number of RPC calls and the call time.

Remote invocation layer (Protocol): encapsulates RPC calls, focusing on Invocation and Result, and extending interfaces for Protocol, Invoker, and Exporter.

Information exchange layer (Exchange): encapsulates the request response mode, changes synchronously, and centers on Request and Response.

Network Transport layer (Transport): abstract mina and netty are unified interfaces, with Message as the center.

8.Dubbo 's service invocation process?

What protocols does 9.Dubbo support, the application scenarios of each protocol, and its advantages and disadvantages?

Dubbo: single persistent connection and NIO asynchronous communication are suitable for service calls with large concurrency and small amount of data, and consumers are much larger than providers. Transport Protocol TCP, Asynchronous, Hessian Serialization

Rmi: implemented by rmi protocol of JDK standard, Serializable interface is required for transmission parameters and return parameter objects, java standard serialization mechanism is used, blocking short connection is used, transmission packet size is mixed, the number of consumers and providers is about the same, files can be transferred, and transfer protocol TCP.

Multiple short connections, TCP protocol transport, synchronous transmission, suitable for conventional remote service invocation and rmi interoperation. There is a security vulnerability in java serialization when relying on an earlier version of Common-Collections package

Webservice: a WebService-based remote call protocol that integrates CXF implementation and provides interoperability with native WebService. Multiple short connections, based on HTTP transport, synchronous transmission, suitable for system integration and cross-language calls

Http: a remote invocation protocol based on Http form submission, implemented using Spring's HttpInvoke. Multiple short connections, transport protocol HTTP, mixed input parameters, more providers than consumers, need to call JS for applications and browsers

Hessian: integrated Hessian services, based on HTTP communication, using Servlet exposure services, Dubbo embedded Jetty as the server when the default implementation, providing interoperability with Hession services. Multiple short connections, synchronous HTTP transmission, Hessian serialization, larger input parameters, larger providers than consumers, greater pressure on providers, and transferable files

Memcache: RPC Protocol based on memcached

Redis: RPC Protocol based on redis

What protocol does 10.dubbo recommend?

Dubbo protocol is used by default

What registries does 11.Dubbo have?

Multicast registry: Multicast registry does not need any central node, as long as the broadcast address, service registration and discovery can be carried out. Implementation of Multicast Transmission based on Network

Zookeeper registry: based on the distributed coordination system Zookeeper implementation, using Zookeeper's watch mechanism to achieve data change

Redis registry: based on redis implementation, using key/Map storage, key storage service name and type, key storage service URL,value service expiration time in Map. Redis-based publish / subscribe model notifies data changes

Simple registry

Java architecture / distributed: 705127209 (Daniel communication group) do not add without development experience!

Service governance of 12.Dubbo?

Too many service URL configuration difficulties

In the case of excessive pressure on load balancing distribution nodes, it is also necessary to deploy clusters.

Service dependency is chaotic and the startup sequence is not clear

Too many services make it difficult to analyze performance indicators and need to be monitored.

13.Dubbo 's registry cluster is down. Can publishers and subscribers still communicate with each other?

Yes, when starting dubbo, consumers will pull data such as the address interface of the registered producer from zookeeper and cache it locally.

Each call is made according to the locally stored address.

Java architecture / distributed: 705 127 209 architectures (Daniel Architecture Circle)

The relationship between 14.Dubbo and Spring?

Dubbo adopts full Spring configuration mode and accesses the application transparently without any API intrusion to the application. You only need to load the configuration of Dubbo with Spring, and Dubbo is loaded based on Schema extension of Spring.

What communication framework does 15.Dubbo use?

The NIO Netty framework is used by default

What load balancing strategies are provided by 16.Dubbo clusters?

Random LoadBalance: randomly select the provider strategy, which is conducive to dynamically adjust the provider weight. The higher the cross section collision rate is, the more the number of calls is, the more uniform the distribution is.

RoundRobin LoadBalance: round-robin selection of provider policies, evenly distributed, but with the problem of request accumulation

LeastActive LoadBalance: least active invocation strategy to solve the problem that slow providers receive fewer requests

ConstantHash LoadBalance: consistent Hash policy, so that requests for the same parameters are always sent to the same provider. When a machine goes down, it can be allocated to other providers based on virtual nodes to avoid drastic changes in providers.

The default is Random random call

What are the cluster fault tolerance schemes of 17.Dubbo?

Failover Cluster

Switch automatically if failure occurs. If failure occurs, retry other servers. It is usually used for read operations, but retry results in a longer delay.

Failfast Cluster

Quick failure, only one call is made, and an error is reported immediately after the failure. It is usually used for non-idempotent write operations, such as adding records.

Failsafe Cluster

Failure security, when an exception occurs, ignore it directly. It is commonly used for operations such as writing audit logs.

Failback Cluster

The failure is automatically recovered, the failed request is recorded in the background and resent regularly. It is commonly used for message notification operations.

Forking Cluster

Multiple servers are called in parallel, and as long as one is successful, it returns. It is usually used for read operations with high real-time requirements, but it needs to waste more service resources. The maximum number of parallelism can be set through forks= "2".

Broadcast Cluster

The broadcast invokes all the providers, one by one, and any one reports an error. It is typically used to notify all providers to update local resource information such as caches or logs.

What is the default cluster fault tolerance scheme for 18.Dubbo?

Failover Cluster

What serialization methods does 19.Dubbo support?

Hessian serialization is used by default, and Duddo, FastJson, and Java come with serialization.

How to set the 20.Dubbo timeout?

There are two ways to set the Dubbo timeout:

The service provider sets the timeout. In the user documentation of Dubbo, it is recommended to configure as much as possible if you can configure more on the server, because the service provider is more aware of the service features it provides than the consumer.

The service consumer sets the timeout. If the timeout is set on the consumer side, it is mainly on the consumer side, that is, the priority is higher. Because the service caller is more flexible in setting timeout control. If the consumer times out, the server thread will not be customized and a warning will be generated.

21. How to solve the problem of service invocation timeout?

When the dubbo invokes the service unsuccessfully, it retries twice by default.

How does 22.Dubbo solve the problem in terms of security mechanism?

Dubbo uses Token tokens to prevent users from bypassing the registry to connect directly, and then manages authorization on the registry. Dubbo also provides a blacklist and whitelist of services to control the callers allowed by the service.

What is the difference between 23.dubbo and dubbox?

Dubbox has made some extensions based on dubbo, such as adding services that can be called by restful, updating open source components and so on.

24. What other distributed frameworks are there besides Dubbo?

What we are familiar with is Spring cloud. Of course, there are many similar frameworks abroad.

The relationship between 25.Dubbo and Spring Cloud?

Dubbo

It is the product of the SOA era, which focuses on service invocation, traffic distribution, traffic monitoring and circuit breakers. And Spring Cloud

Born in the era of micro-service architecture, considering all aspects of micro-service governance, and relying on Spirng and Spirng Boot

Based on the advantages of the two frameworks, the goals of the two frameworks are inconsistent at the beginning. Dubbo location service governance and Spirng Cloud are an ecology.

The difference between 26.dubbo and spring cloud?

The biggest difference: the bottom layer of Dubbo uses a NIO framework such as Netty, which is transmitted based on TCP protocol, together with Hession serialization to complete RPC communication.

SpringCloud is based on Http protocol + Rest interface to call remote process communication, relatively speaking, Http requests will have larger messages and occupy more bandwidth. However, REST is more flexible than RPC, and the dependence of service providers and callers only depends on a contract, and there is no strong dependence at the code level, which is more appropriate in a micro-service environment that emphasizes rapid evolution. As for whether to focus on communication speed or convenience and flexibility, specific consideration should be given to the specific circumstances.

This is the end of the content of "what is the core function of Dubbo". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report