About Dubbo

What is dubbo

dubbo is a distributed framework, distributed remote service invocation framework, the core contains: a cluster fault tolerance: providing a transparent interface method is based on remote procedure calls, including multi-protocol support, as well as soft load balancing, fault tolerance failure, address routing, dynamic cluster configuration and other support. Remote Communication: providing a variety of frame based NIO package length abstract connection model comprises a plurality of threads, serialization, and - information exchange "request-response" mode. Automatic discovery: a registry-based directory service, the service can only consume dynamic lookup service provider, the address is transparent, so that the service provider may increase or decrease smooth machine.

What do dubbo

Transparent remote method invocation, the same as calling a local method call remote methods, only a simple configuration, there is no API invasion. Soft load balancing and fault tolerance mechanisms, including the network can replace F5 hardware load balancer, lower costs, reduce single point. Automatic registration and service discovery, no longer need to write the dead service provider address, IP address registry based query interface name service provider, and can be smoothly add or remove services provider.

1, what is used by default communications framework, there are other options?

A: The default is also recommended netty framework, as well as mina.

2, the service call is blocking it?

A: The default is blocked, can be called asynchronously, there is no return value can do.

3, generally use what registry? There are other options?

A: The recommended zookeeper registration centers, and Multicast registration center, Redis registry, Simple registration center.

ZooKeeper nodes is carried out by maintaining the tree-like structure, and each node denoted by a path and access. In addition, each node also has some information about themselves, including: data, data length, creation time, modification time and so on.

4, what is the default serialization framework, you know What?

A: The default Hessian serialization, there Duddo, FastJson, Java native serialization. hessian frame is a binary format using the transmission service, compared to the traditional soap web service, lighter, faster.

Hessian principle and protocol analysis:

http protocol agreed data transmission mode, hessian can not change too much:

1) interaction in hessian client and server-based http-post manner.

2) hessian auxiliary information encapsulated in http header, such as "authorization token" and so on, we can be based on http-header package on "security check" "meta data" and so on. hessian provides a simple "check" mechanism.

3) For the interaction of hessian core data, such as "method call" and the parameter list information, it will send the request via the post body member, the format of the byte stream.

4) The server-side hessian response data, through the direct output response in the byte stream.

hessian protocol itself is not complicated, which is not to say; so-called Protocol (protocol) is constrained format data, client requests information in accordance with the protocol sequence into a sequence of bytes sent to the server side, the server side according to the protocol, the data is deserialized into "subject", then perform the specified method, and the return value of the method according to the protocol again serialized into byte stream, in response to the client, client according to the agreement, then the byte stream to deserialize "subject."

5, service providers can realize what failure is kicked out of principle?

A: The service kicked out of the failure based on the temporary node principle of zookeeper.

6, on-line service does not affect how the old version?

A: The development of multi-version, does not affect older versions. Add in the configuration version as the version to distinguish

7, how to solve the problem of long-chain service call?

A: You can combine zipkin implement a distributed service tracking.

8, talk about the core configuration What?

Core configuration are:

1) dubbo:service/

2) dubbo:reference/

3) dubbo:protocol/

4) dubbo:registry/

5) dubbo:application/

6) dubbo:provider/

7) dubbo:consumer/

8) dubbo:method/

9, dubbo agreement with what is recommended?

A: The default dubbo protocol.

10, the case of multiple services can be registered with a direct one service?

A: Yes Direct Connect, you can modify the configuration, you can also telnet directly to a service.

11, dubbo in terms of how to solve the security mechanism?

dubbo token by token registry to prevent users from bypassing directly connected, then the registration center management authorization, dubbo provides black and white lists, control service allowed by the caller.

12, fault-tolerant cluster how to do?

A: Read recommended Failover automatically switch fails, the default retry two other servers. Write operation is recommended to use rapid-fail Failfast, immediately issued a call failed error.

13, in the course of what problems are encountered? How to solve?

1) You must configure the XML and properties files, the properties of the configuration is invalid

Only when there is no XML configuration, properties to take effect.

2) dubbo default checks depend on availability at the time of start, throwing an exception is not available, spring stop initialization is complete, check property defaults to true.

Some services do not care about the test or there is a cycle of dependence, the check is set to false

3) In order to facilitate the development of the test, there is a registry of all the services available under the line, then, if there is an ongoing development of the service provider registered, may affect consumers not function properly.

Solution: Let the developer of the service provider, only subscription service without registration service under development, the test is being developed through direct services. Set dubbo: register property registry label is false.

4) spring 2.x initialization deadlock.

In the spring resolves to dubbo: when the service, the service has been exposed to the outside, but spring is still then initialize other bean, then if there is a request comes in, and implement such services, there are calls applicationContext.getBean () usage. order getBean threads and locks spring initialize the thread is not the same, resulting in a thread deadlock can not provide services to not start.

Solution: Do not use the service implementation class to applicationContext.getBean (); if you do not rely on the order of configuration, may be dubbo: deplay property provider to - 1, so that after the container Dubbo exposed service initialization is complete.

5) can not register for the service

Check dubbo a jar in the classpath there, and there are no duplicates jar package

Check the exposed services spring configuration has no load

In the service provider network testing machine with registry whether through

6) appears RpcException: No provider available for remote service anomalies

That there is no available service providers,

a. Check the connection of the registry is correct

b. to view the registry service provider if there is

c. Check service provider is operating normally

7) The "Failed to send message" Exception

Incoming usually outgoing interface method parameter is not implemented Serializable.

14, the difference between the dubbo and dubbox?

A: dubbox Dangdang is based on dubbo do some extensions, such as adding a service call can be restful, updating open source components.

15, you also learn about other distributed frame it?

A: There are other spring of spring cloud, facebook's thrift, twitter of finagle and so on.

16, Dubbo support which protocols, application protocols for each scenario, the advantages and disadvantages?

dubbo: NIO single long connection and asynchronous communications, for large concurrent small amount of data service calls, as well as consumers far outweigh provider. Transport Protocol TCP, asynchronous, Hessian serialization;

rmi: using standard JDK rmi protocol, transmission and return parameters need to implement the Serializable interface objects using a serialization mechanism java standard, blocking the use of short connection, the number of transmission packet size mixing, almost consumers and providers, can transfer files, transfer protocol TCP. A plurality of short connection, TCP transport protocol, synchronous transmission, applicable to conventional remote service invocation and rmi interoperability. In the low-dependent version of the Common-Collections package, java serialized security flaws;

webservice: Based on WebService remote invocation protocol, integrated CXF implementation, and provides native interoperability WebService. Multiple short connections, HTTP transmission is based, synchronous transmission for system integration and cross-language calls; http: Http-based remoting protocol form submission, using Spring's HttpInvoke achieved. Multiple short connections, HTTP transmission protocol, the number of parameters passed in mixed sizes, providers than consumers, need to give the application and browser JS call; hessian: Hessian Integration Services, HTTP-based communications, the use of Servlet exposed services, Dubbo embedded Jetty server as the default implementation, providing Hession service interoperability. A plurality of short connection, HTTP synchronous transmission, Hessian serialized incoming parameter greater, the consumer is greater than the provider, the provider pressure, can transfer files;

memcache: redis memcached-based RPC protocol implementation: redis-based RPC protocol implementation

17, load-balancing cluster Dubbo What are some strategies

Dubbo provides a common cluster policy implementation, and pre-extension points to be self-fulfilling.

Random LoadBalance: randomly selected provider policy is conducive to dynamically adjust the weights provider. Collision cross section is high, the more the number of calls, the more uniform distribution;

RoundRobin LoadBalance: select round robin provider policy, evenly distributed, but there is a problem request cumulative;

LeastActive LoadBalance: Minimum active call strategy to tackle the slow provider receives fewer requests; ConstantHash LoadBalance: Hash policy consistency, the same parameter requests are always sent to the same provider, a machine downtime, can be based on virtual node, assessed to other providers, to avoid drastic change providers;

18, the service call times out how to solve the problem

dubbo when calling the service is not successful, the default is retried twice. In this way the server processing time exceeds the set timeout period, there will be a repeat request, such as when the mail may be issued a number of duplicate messages will, when performing the registration request, registration data will insert multiple repetitive then how to solve the timeout problem? as follows

For the core of the service center, remove dubbo retry mechanism timeout, set the timeout and re-evaluate. Business processing code must be placed in service, the client only parameter validation and service calls do not involve business process global configuration examples

 

Of course retry mechanism Dubbo is actually very good QOS guarantees, its routing mechanism, that will help you take time out to route requests to the other machine, rather than try this machine, so dubbo retry the machine can also be a certain degree of ensure the quality of services. But be sure to visit the case of a comprehensive line gives a comprehensive assessment.

Guess you like

Origin www.cnblogs.com/Koaler/p/12033181.html