Dubbo, as a mainstream framework for microservices, is believed to be something that few people, whether working or studying, can bypass. Today I’ve prepared some Dubbo essentials for you, which are also interview questions.

1. What is Dubbo?

Dubbo is a Java-based high-performance lightweight RPC distributed services framework that is now an Apache Foundation incubator project.

Website: http://dubbo.apache.org/en-us/

2. Why Dubbo?

Background:

With the rapid growth of the Internet, the scale of Web applications grew, and we found that the traditional vertical architecture (monolithic) couldn’t handle it. Distributed service architecture and flow computing architecture are imperative, and a governance system is urgently needed to ensure the orderly development of the architecture.

  • Free open source
  • Some of the core businesses are extracted and served as separate services, gradually forming a stable service center so that front-end applications can better respond to changing market requirements
  • Distributed frameworks can handle much larger volumes of traffic
  • High internal Netty – based performance

3. What are the three key features Dubbo offers?

Interface-based remote invocation

Fault tolerance and load balancing

Automatic service registration and discovery

4. Do you know which agencies use Dubbo?


5. What are the key nodes of Dubbo service?


6. What is the Dubbo service registration process?

  1. The service container is responsible for starting, loading, and running the service provider.
  2. At startup, service providers register their services with the registry.
  3. At startup, service consumers subscribe to the registry for the services they need.
  4. The registry returns a list of service provider addresses to the consumer, and if there are changes, the registry pushes the change data to the consumer based on the long connection.
  5. The service consumer, from the provider address list, selects one provider to call based on the soft load balancing algorithm. If the call fails, selects another one to call.
  6. Service consumers and providers accumulate calls and call times in memory and regularly send statistics to the monitoring center every minute.

7. Can you draw the service registration flow chart?

image-20200423110344448

8. What are the characteristics of the Dubbo architecture?

Connectivity, robustness, scalability, and scalability to future architectures.

9. Need a minimum version of the JDK?

Jdk1.6 +

10. Registry selection?

Zookeeper is generally more stable and appropriate.

In addition to Zookeeper, there are also Redis, Multicast, and Simple registries.

11.Dubbo’s core configuration? Purpose?


12. Configure priority rules.


Priority from high to low:

  • The JVM -D parameter, which can be easily rewritten when you deploy or start the application, for example, changing the Dubbo protocol port;
  • XML, the current configuration in XML overrides dubo.properties;
  • Properties, the default configuration, only applies when neither of the above is configured.

13. How to bypass the registry point-to-point direct connection in code?

... 
ReferenceConfig<XxxService> reference = new ReferenceConfig<XxxService>(); // This instance is very heavy and encapsulates the connection to the registry and the connection to the provider. Please cache it yourself, otherwise it may cause memory and connection leaks
// Reference. SetUrl () can be used to specify the destination address, setting the URL will bypass the registry,
// The protocol corresponds to provider.setprotocol (), the port corresponds to provider.setport (),
// The value of the path corresponding to service.setPath(). If path is not set, the default path is the interface name reference.setUrl("Dubbo: / / 10.20.130.230:20880 / com. XXX. XxxService");  ...Copy the code

14. How many sources are there for Dubbo configuration? Is respectively?

Four kinds of

  • JVM System Properties, -d parameter
  • Externalized Configuration: Externalized Configuration
  • Configuration collected by ServiceConfig and ReferenceConfig programming interfaces
  • Local configuration file dubo.properties

15. How do I disable the startup check of a service?

<dubbo:reference interface = "com.foo.BarService" check = "false" />
Copy the code

16.Dubbo load balancing policy? The default is?

  • Random load Balancing (default)

  • RoundRobin Load balancing

  • Minimum active load balancing

  • Consistent hash load balancing

17. Compatible with older versions?

Multiple versions

18. How to configure the test environment to bypass the registry?

  • xml
 <dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />

Copy the code
  • -D

    java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890
    Copy the code
  • .properties

    java -Ddubbo.resolve.file=xxx.properties
    Copy the code
com.alibaba.xxx.XxxService=dubbo://localhost:20890
Copy the code

19. How many methods of cluster fault tolerance?

image-20200423121735540

20. How many ways can Dubbo be configured?

  1. Spring
  2. Java API

21. What are the agreements for Dubbo? Recommend?

  • Dubbo: / / (recommended)
  • rmi://
  • hessian://
  • http://
  • webservice://
  • thrift://
  • memcached://
  • redis://
  • rest://

22. What communication framework does Dubbo use?

Dubbo uses Netty.

23. Default dubbo port number? Default HTTP port? hessian? rmi?

  • dubbo:20880
  • http:80
  • hessian:80
  • rmi:80

Dubbo default serialization framework? What else do you know?

  • The default dubbo protocol is hessian2
  • The rmI protocol is Java by default
  • The default HTTP protocol is JSON

25. What happens when a service has multiple implementations?

Groups can be used, with both service providers and consumers specifying the same group.

26.Dubbo service invocation is blocked by default? What else?

The default is synchronous waiting for results to block, while asynchronous calls are also supported.

Dubbo is a non-blocking parallel invocation based on NIO. The client can complete the parallel invocation of multiple remote services without starting multithreading. Compared with multithreading, the overhead is relatively small.

Dubbo Service Tracking solution?

  • Zipkin
  • Pinpoint
  • SkyWalking

28. Is Dubbo out of maintenance? What’s the difference between a Dubbo and a Dubbox?

Now you’re in Apache, maintained by Apache.

Dubbox is an extension of Dangdang.

29. What’s new with Dubbox?

  • Support for RESTFUL remote calls (HTTP + JSON/XML)

  • Support efficient Java serialization implementation based on Kryo and FST

  • Supports HTTP Remoting based on embedded Tomcat

  • To upgrade the Spring

  • Example Upgrade the ZooKeeper client

30. Default IO thread pool size?

Number of cpus + 1

31. Dubbo :// What service invocation is appropriate for the protocol?

The use of a single long link and NIO asynchronous communication is suitable for small number of large concurrent service invocations, and the number of service consumer machines is much larger than the number of service provider machines.

Not suitable for services that transfer large amounts of data, such as files, videos, etc., unless the request volume is very low.

image-20200423154308365

32. How does auto-culling work?

Zookeeper temporary node, session persistence principle.

From 33.At 2.0.5Dubbo supports service governance via the x command.

telnet

34. How do I view the service list using a command?

telnet localhost 20880
Copy the code

Go to the command line. Then run the ls command:

  • ls: Displays the service list
  • ls -l: Displays the service details list
  • ls XxxService: Displays a list of methods for the service
  • ls -l XxxService: Displays a list of method details for the service

35. What is the Dubbo frame design?


Description of each layer:

  • The config configuration layer: Configures interfaces externallyServiceConfig.ReferenceConfigThe configuration classes can be initialized directly or generated by Parsing the configuration through Spring
  • Proxy Service proxy layer: service interface transparent proxy that generates the client Stub and server Skeleton of the service toServiceProxyIs the center, and the extension interface isProxyFactory
  • The central layer of Registry: encapsulates the registration and discovery of service addresses, centering on service urls and extending interfacesRegistryFactory.Registry.RegistryService
  • Cluster routing layer: encapsulates routing and load balancing for multiple providers and Bridges registries toInvokerIs the center, and the extension interface isCluster.Directory.Router.LoadBalance
  • The monitor monitoring layer: RPC call times and call time monitoring toStatisticsIs the center, and the extension interface isMonitorFactory.Monitor.MonitorService
  • Protocol Remote call layer: encapsulates RPC calls toInvocation.ResultIs the center, and the extension interface isProtocol.Invoker.Exporter
  • Exchange Information exchange layer: Encapsulates the request response mode, synchronous to asynchronous, toRequest.ResponseIs the center, and the extension interface isExchanger.ExchangeChannel.ExchangeClient.ExchangeServer
  • Transport Indicates the transport layer of the networkAbstract mina and Netty as unified interfaces toMessageIs the center, and the extension interface isChannel.Transporter.Client.Server.Codec
  • Serialize Data serialization layer: some reusable tools, extension interface forSerialization.ObjectInput.ObjectOutput.ThreadPool

Reference:

  • http://dubbo.apache.org/en-us/
  • Baidu encyclopedia

The article continues to be updated at ⛽️. Additional blogger arranges + original 150 thousand literal test questions, including 17 special topics. You are welcome to follow the “Java junior talent show” reply “interview” to get the Java junior talent show interview notes. PDF

This article is formatted using MDNICE