In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the interview questions of Dubbo". In the operation of actual cases, many people will encounter such a dilemma. Next, 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 dubbo?
Dubbo is a distributed framework for remote service invocation. Its core includes: cluster fault tolerance: providing 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. Remote communication: provides abstract encapsulation of a variety of long-connection-based NIO frameworks, including multiple thread models, serialization, and information exchange in the "request-response" pattern. Automatic discovery: based on the registry directory service, the service consumer can dynamically find the service provider, make the address transparent, and enable the service provider to smoothly increase or decrease the number of machines.
What can dubbo do?
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.
1. What communication framework is used by default? is there any other choice?
A: the netty framework and mina are also recommended by default.
2. Is the service call blocked?
Answer: it is blocked by default and can be called asynchronously, and those with no return value can do so.
3. What kind of registration center is commonly used? Is there any other choice?
A: it is recommended to use zookeeper registry, Multicast registry, Redis registry and Simple registry.
The nodes of ZooKeeper are maintained by a tree-like structure, and each node is marked and accessed by a path. In addition, each node has its own information, including data, data length, creation time, modification time, and so on.
4. What serialization framework is used by default, and what else do you know?
Answer: Hessian serialization is used by default, and Duddo, FastJson and Java have their own serialization. Hessian is a service framework transmitted in binary format, which is lighter and faster than traditional soap web service.
A brief Analysis of the principles and protocols of Hessian
Http's protocol prescribes the way data is transmitted, and hessian cannot change much:
1) the interaction between client and server in hessian is based on http-post.
2) hessian encapsulates auxiliary information in http header, such as "authorized token". We can encapsulate "security check" and "meta data" based on http-header. Hessian provides a simple "check" mechanism.
3) the interactive core data of hessian, such as "called method" and parameter list information, will be sent directly through the body of the post request in the format of byte stream.
4) the response data on the server side of hessian will be output directly in response through byte stream.
Hessian's agreement itself is not complicated, so I won't dwell on it here. The so-called protocol is to constrain the format of the data. According to the protocol, client serializes the request information into a byte sequence and sends it to the server. According to the protocol, the server deserializes the data into an "object", then executes the specified method, and serializes the return value of the method into a byte stream again according to the protocol, and responds to client,client to turn the byte stream into an "object" according to the protocol.
5. What is the principle that service providers can achieve failure kick-out?
A: service failure kicks out the temporary node principle based on zookeeper.
6. Why does the launch of the service not affect the old version?
Answer: adopt multi-version development, do not affect the old version. Add version to the configuration as a version distinction
7. How to solve the problem that the service call chain is too long?
A: distributed service tracking can be implemented in conjunction with zipkin.
8. What are the core configurations?
The core configurations 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. What protocol does dubbo recommend?
Answer: dubbo protocol is used by default.
10. Can I directly connect to a service in the case of multiple registrations for the same service?
A: you can connect directly, modify the configuration, or directly use a service through telnet.
11. How does 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 in the registry, where dubbo provides a blacklist and whitelist to control the callers allowed by the service.
12. How to do cluster fault tolerance?
A: it is recommended to use Failover to automatically switch when the read operation fails. By default, retry other servers twice. It is recommended to use Failfast for write operations to fail quickly. If a call fails, an error will be reported immediately.
13. What problems have you encountered in the process of use? How did you solve it?
1) if both XML and properties files are configured, the configuration in properties is invalid
Properties takes effect only if XML is not configured.
2) by default, dubbo checks whether the dependency is available at startup, and throws an exception if it is not available to prevent spring initialization from being completed. The check attribute defaults to true.
Some services do not care or have circular dependencies during testing. Set check to false.
3) in order to facilitate development and testing, there is a registry where all services are available offline. At this time, if there is a service provider under development, it may affect the normal operation of consumers.
Solution: let the service provider developer subscribe to the service instead of registering the service under development and test the service under development through a direct connection. Set the register property of the dubbo:registry tag to false.
4) spring 2.x initialization deadlock problem.
When spring parses to dubbo:service, the service is exposed, and spring then initializes other bean, if a request comes in, and the service's implementation class has the use of calling applicationContext.getBean (). The lock order of the getBean thread and the spring initialization thread is different, resulting in the thread deadlock, unable to provide service, and unable to start.
Solution: do not use applicationContext.getBean () in the implementation class of the service; if you do not want to rely on the configuration order, you can set the deplay property of dubbo:provider to-1 so that dubbo exposes the service after the container initialization is complete.
5) the service is not registered
Check whether dubbo's jar package is in classpath, and if there are any duplicate jar packages.
Check whether the spring configuration of the exposure service is loaded
Test whether the network with the registry is connected to the service provider machine
6) RpcException: No provider available for remote service exception occurred
Indicates that there are no available service providers
a. Check whether the connected registry is correct
b. Go to the registry to see if the corresponding service provider exists
c. Check whether the service provider is running properly
7) A "message delivery failure" exception occurred
Typically, the Serializable interface is not implemented by the incoming and outgoing parameters of the interface method.
14. What's the difference between dubbo and dubbox?
A: dubbox is based on dubbo and has made some extensions, such as adding services that can be called by restful, updating open source components, and so on.
15. Do you know anything about other distributed frameworks?
A: there are also spring's spring cloud,facebook, thrift,twitter 's finagle and so on.
16. What protocols does 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 transmission, synchronous transmission, suitable for system integration and cross-language calls; http: remote call protocol based on Http form submission, using Spring's HttpInvoke implementation. Multiple short connections, transport protocol HTTP, mixed input parameters, more providers than consumers, need to call JS to 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, provides 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
17. What are the strategies for load balancing in Dubbo clusters
Dubbo provides the common implementation of cluster strategy, and the pre-expansion point is implemented by itself.
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, and a machine goes down, which can be allocated to other providers based on virtual nodes to avoid drastic changes in providers.
18. How to solve the service invocation timeout problem
When the dubbo invokes the service unsuccessfully, it retries twice by default. In this way, when the processing time of the server exceeds the set timeout, there will be repeated requests. For example, when sending an email, multiple duplicate emails may be sent, and multiple duplicate registration data will be inserted when the registration request is executed. So how to solve the timeout problem? As follows
For the core service center, remove the dubbo timeout retry mechanism and re-evaluate the setting timeout. The business processing code must be placed on the server side, and the client only does parameter verification and service invocation, and does not involve the business process to handle the global configuration instance.
Of course, Dubbo's retry mechanism is actually a very good QOS guarantee. Its routing mechanism will help you route timed-out requests to other machines instead of trying locally, so dubbo's retry machine can also guarantee the quality of service to a certain extent. However, please be sure to synthesize the online visits and give a comprehensive assessment.
This is the end of the content of "what are the interview questions for Dubbo". Thank you for your 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.