FaQs

What are the load balancing policies for Dubbo clusters

  • Random LoadBalance: Provider policies are randomly selected to dynamically adjust provider weights. The cross section collision rate is high, the more calls, the more uniform distribution;

  • RoundRobin LoadBalance: Indicates that provider policies are evenly distributed, but requests are accumulated.

  • LeastActive LoadBalance: LeastActive LoadBalance: the LeastActive call policy, the slower provider receives fewer requests;

  • ConstantHash LoadBalance: a consistent Hash policy. Requests for the same parameters are always sent to the same provider. If a machine is down, it can be allocated to other providers based on virtual nodes to avoid drastic changes in providers.

Which protocols Dubbo supports

  • Dubbo: Single long connection and NIO asynchronous communication, suitable for large concurrent and small data volume service calls, and far more consumers than providers. TCP, asynchronous, Hessian serialization;

  • Rmi: using JDK standard RMI protocol implementation, transmission parameters and return parameter objects need to implement Serializable interface, the use of Java standard serialization mechanism, the use of blocking short connection, transmission packet size mixed, the number of consumers and providers is about the same, can transfer files, transmission protocol TCP. Multiple short connections, TCP transport, synchronous transport, suitable for general remote service calls and RMI interoperation. Java serialization suffers from security vulnerabilities when relying on earlier versions of the Common-Collections package;

  • Webservice: Remote call protocol based on WebService, integrated with CXF implementation, providing interoperability with native WebService. Multiple short connections, based on HTTP transmission, synchronous transmission, suitable for system integration and cross-language call;

  • HTTP: A remote invocation protocol based on HTTP form submission, implemented using Spring’s HttpInvoke. Multiple short connections, transport protocol HTTP, mixed sizes of incoming parameters, more providers than consumers, need to give application and browser JS calls;

  • Hessian: Integrated Hessian service, based on HTTP communication, using Servlet to expose the service, Dubbo embedded Jetty as the default implementation of the server, providing interoperation with Hession service. Multiple short connections, synchronous HTTP transfers, Hessian serialization, large incoming parameters, more providers than consumers, greater provider pressure, passable files;

  • Memcache: RPC protocol based on memcached

  • Redis: RPC protocol based on redis

The Dubbo framework is divided into 10 layers:

  • Service interface layer: This layer is related to the actual business logic and designs corresponding interfaces and implementations according to the business of Service providers and Service consumers.

  • Configuration layer (Config) : External configuration interface centered on ServiceConfig and ReferenceConfig.

  • Proxy: Transparent Proxy of the service interface, generating the client Stub and server Skeleton of the service.

  • Service Registration layer (Registry) : encapsulates the registration and discovery of service addresses, centering on service urls.

  • Cluster layer (Cluster) : encapsulates routing and load balancing of multiple providers and Bridges registries, centered on Invoker.

  • Monitor: Monitors the number and time of RPC calls.

  • Remote Invocation layer (Protocol) : Dispatcher RPC calls with Protocol, Invoker and Exporter interfaces centered on Invocation and Result.

  • Information Exchange layer (Exchange) : encapsulates the Request and Response mode, turns synchronous to asynchronous, and centers on Request and Response.

  • Network Transport Layer (Transport) : Abstract Mina and Netty as a unified interface, centered on Message.

  • Serialize: a reusable tool that extends Serialization, ObjectInput, ObjectOutput, and ThreadPoo

What are Dubbo’s cluster fault tolerance schemes?

  • Failover Cluster Failover automatically occurs. If the Failover occurs, retry other servers. Typically used for read operations, but retries introduce longer delays. Default cluster fault tolerance scheme

  • Failfast Cluster fails rapidly. An error is reported immediately after the Failfast Cluster invocation is initiated only once. Typically used for non-idempotent writes, such as new records.

  • Failsafe Cluster Failsafe. If exceptions occur, ignore them. It is used to write audit logs.

  • Failback Cluster automatically recovers when Failback Cluster fails. Failure requests are recorded in the background and resent periodically. Typically used for message notification operations.

  • The Forking Cluster calls multiple servers in parallel and returns if one succeeds. It is usually used for read operations that require high real-time performance but waste more service resources. The maximum parallel number can be set by forks=”2″.

  • Broadcast Cluster broadcasts calls to all providers one by one. An error is reported on any one provider. Typically used to notify all providers to update local resource information such as caches or logs.

Hessian protocol

Hessian objects have eight primitive types:

  1. Native binary data

  2. Boolean

  3. The date of the 64-bit millisecond value

  4. A 64 – bit double

  5. 32-bit int

  6. A 64 – bit long

  7. null

  8. Utf-8 string

There are three types of loops:

  1. list for lists and arrays

  2. map for maps and dictionaries

  3. object for objects

Finally, he has a special composition:

  1. Share and loop object references