Dubbo basic concepts

Dubbo distributed service framework is the most famous, one will be the framework for Java programmers is essential. Dubbo is senior interview process often ask technologies, regardless of whether you used, you must be familiar with.

Now I prepare for everyone Dubbo some common interview questions, something I often ask others, some of which are some of the problems I encountered in past interviews, summarize for everyone, we want to be able to help.


1, Dubbo What is that?

Dubbo Alibaba open source high performance RPC-based distributed services framework for Java, has now become the Apache Foundation incubator project.

The interviewer asks if you are not sure, that there is no need to ask the following.

Official website: http: //dubbo.apache.org

2. Why Dubbo?

Because Ali is an open source project, many domestic companies are using the Internet, it has been through many online test. Internal use of Netty, Zookeeper, ensures high performance and high availability.

Use Dubbo can be drawn out of the core business, as an independent service, and gradually form a stable service center, can be used to improve service multiplexing flexible expansion, the front-end applications to more quickly respond to changing market demands.

 

The picture below it is clear interpretation, the most important point is that the distributed architecture can withstand larger concurrent flow.

640?wx_fmt=jpeg

The following is a diagram Dubbo governance of service.

640?wx_fmt=jpeg

3, Dubbo and Spring Cloud What is the difference?

Two did not associate, if you insist distinction, the following points.

1) Communication in different ways

Dubbo using RPC communications, while Spring Cloud using HTTP RESTFul manner.

2) part of a different

640?wx_fmt=png

4, dubbo support any agreement, which recommended use?

  • dubbo: // (recommended)

  • rmi://

  • hessian://

  • http://

  • webservice://

  • thrift://

  • memcached://

  • repeat: //

  • rest://

5, Dubbo Web container needs it?

不需要,如果硬要用 Web 容器,只会增加复杂性,也浪费资源。

6、Dubbo内置了哪几种服务容器?

  • Spring Container

  • Jetty Container

  • Log4j Container

Dubbo 的服务容器只是一个简单的 Main 方法,并加载一个简单的 Spring 容器,用于暴露服务。

7、Dubbo里面有哪几种节点角色?

640?wx_fmt=png

8、画一画服务注册与发现的流程图

640?wx_fmt=png

该图来自 Dubbo 官网,供你参考,如果你说你熟悉 Dubbo, 面试官经常会让你画这个图,记好了。

9、Dubbo默认使用什么注册中心,还有别的选择吗?

推荐使用 Zookeeper 作为注册中心,还有 Redis、Multicast、Simple 注册中心,但不推荐。

10、Dubbo有哪几种配置方式?

1)Spring 配置方式
2)Java API 配置方式

11、Dubbo 核心的配置有哪些?

我曾经面试就遇到过面试官让你写这些配置,我也是蒙逼。。

640?wx_fmt=png

配置之间的关系见下图。

640?wx_fmt=jpeg

12、在 Provider 上可以配置的 Consumer 端的属性有哪些?

1)timeout:方法调用超时
2)retries:失败重试次数,默认重试 2 次
3)loadbalance:负载均衡算法,默认随机
4)actives 消费者端,最大并发调用限制

13、Dubbo启动时如果依赖的服务不可用会怎样?

Dubbo 缺省会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止 Spring 初始化完成,默认 check="true",可以通过 check="false" 关闭检查。

14、Dubbo推荐使用什么序列化框架,你知道的还有哪些?

推荐使用Hessian序列化,还有Duddo、FastJson、Java自带序列化。

15、Dubbo默认使用的是什么通信框架,还有别的选择吗?

Dubbo 默认使用 Netty 框架,也是推荐的选择,另外内容还集成有Mina、Grizzly。

16、Dubbo有哪几种集群容错方案,默认是哪种?

640?

17、Dubbo有哪几种负载均衡策略,默认是哪种?

640?

18、注册了多个同一样的服务,如果测试指定的某一个服务呢?

可以配置环境点对点直连,绕过注册中心,将以服务接口为单位,忽略注册中心的提供者列表。

19、Dubbo支持服务多协议吗?

Dubbo 允许配置多协议,在不同服务上支持不同协议或者同一服务上同时支持多种协议。

20、当一个服务接口有多种实现时怎么做?

当一个接口有多种实现时,可以用 group 属性来分组,服务提供方和消费方都指定同一个 group 即可。

21、服务上线怎么兼容旧版本?

可以用版本号(version)过渡,多个不同版本的服务注册到注册中心,版本号不同的服务相互间不引用。这个和服务分组的概念有一点类似。

22、Dubbo可以对结果进行缓存吗?

可以,Dubbo 提供了声明式缓存,用于加速热门数据的访问速度,以减少用户加缓存的工作量。

23、Dubbo服务之间的调用是阻塞的吗?

默认是同步等待结果阻塞的,支持异步调用。

Dubbo 是基于 NIO 的非阻塞实现并行调用,客户端不需要启动多线程即可完成并行调用多个远程服务,相对多线程开销较小,异步调用会返回一个 Future 对象。

异步调用流程图如下。

640?wx_fmt=jpeg

24、Dubbo支持分布式事务吗?

目前暂时不支持,后续可能采用基于 JTA/XA 规范实现,如以图所示。

640?wx_fmt=jpeg

25、Dubbo telnet 命令能做什么?

dubbo 通过 telnet 命令来进行服务治理,具体使用看这篇文章《dubbo服务调试管理实用命令》。

telnet localhost 8090

26、Dubbo支持服务降级吗?

Dubbo 2.2.0 以上版本支持。

27、Dubbo如何优雅停机?

Dubbo 是通过 JDK 的 ShutdownHook 来完成优雅停机的,所以如果使用 kill -9 PID 等强制关闭指令,是不会执行优雅停机的,只有通过 kill PID 时,才会执行。

28、服务提供者能实现失效踢出是什么原理?

服务失效踢出基于 Zookeeper 的临时节点原理。

29、如何解决服务调用链过长的问题?

Dubbo 可以使用 Pinpoint 和 Apache Skywalking(Incubator) 实现分布式服务追踪,当然还有其他很多方案。

30、服务读写推荐的容错策略是怎样的?

读操作建议使用 Failover 失败自动切换,默认重试两次其他服务器。

写操作建议使用 Failfast 快速失败,发一次调用失败就立即报错。

31、Dubbo必须依赖的包有哪些?

Dubbo 必须依赖 JDK,其他为可选。

32、Dubbo的管理控制台能做什么?

管理控制台主要包含:路由规则,动态配置,服务降级,访问控制,权重调整,负载均衡,等管理功能。

33、说说 Dubbo 服务暴露的过程。

Dubbo 会在 Spring 实例化完 bean 之后,在刷新容器最后一步发布 ContextRefreshEvent 事件的时候,通知实现了 ApplicationListener 的 ServiceBean 类进行回调 onApplicationEvent 事件方法,Dubbo 会在这个方法中调用 ServiceBean 父类 ServiceConfig 的 export 方法,而该方法真正实现了服务的(异步或者非异步)发布。

34、Dubbo 停止维护了吗?

2014 年开始停止维护过几年,17 年开始重新维护,并进入了 Apache 项目。

35、Dubbo 和 Dubbox 有什么区别?

Dubbox is the second stop maintenance Dubbo, Dubbo Dangdang do a project based on extension, such as adding a Restful service call, updating open source components.

36, you also learn about other distributed frame it?

There are other Spring cloud, Facebook's Thrift, Twitter's Finagle and so on.

37, Dubbo it can integrate Spring Boot?

Yes, the project address below.

https://github.com/apache/incubator-dubbo-spring-boot-project

38, in the course of what problems are encountered?

Dubbo is designed to meet the high volume of concurrent small data rpc call, the performance in the large amount of data is not good, it is recommended to use rmi or http protocol.

39, Dubbo source you read it?

To learn Dubbo we must look at its source code, understand its principles, take a moment to look at it, there are many online tutorials, follow-up time I will share the source code in Dubbo on public number.

40, you feel good with Dubbo good or Spring Cloud?

Extension of the problem, there is no good or bad, only not suitable, but I seem to prefer Dubbo, Spring Cloud version upgrade too quickly, replace the component updates too frequently, the configuration is too complicated, there are a lot I think it is not handy Dubbo local……

Guess you like

Origin www.cnblogs.com/bruce0706/p/11269754.html