亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
Contents
1.Dubbo interview questions
1. Why use Dubbo?
2. What are the layers of Dubbo’s overall architecture design?
3. What communication framework is used by default? Are there any other options?
4. Is the service call blocking?
5. What registration center is generally used? Are there any other options?
6. What serialization framework is used by default? What else do you know?
7. What is the principle behind the failure kicking of service providers?
8. How can the service go online without affecting the old version?
9. How to solve the problem of too long service call chain?
10. What are the core configurations?
11. What protocol does Dubbo recommend?
#12. Can I directly connect to a certain service if there are multiple registrations for the same service?
13. Draw a flow chart of service registration and discovery?
14. How many solutions are there for Dubbo cluster fault tolerance?
#15. Dubbo service is downgraded. How to retry after failure?
16. What problems did you encounter when using Dubbo?
17 , Dubbo Monitor implementation principle?
18. What design patterns does Dubbo use?
19、Dubbo 配置文件是如何加載到 Spring 中的?
20、Dubbo SPI 和 Java SPI 區(qū)別?
21、Dubbo 支持分布式事務嗎?
22、Dubbo 可以對結(jié)果進行緩存嗎?
23、服務上線怎么兼容舊版本?
24、Dubbo 必須依賴的包有哪些?
25、Dubbo telnet 命令能做什么?
26. Does Dubbo support service downgrade?
27. How does Dubbo shut down gracefully?
28. What is the difference between Dubbo and Dubbox?
29. What is the difference between Dubbo and Spring Cloud?
30. Do you know other distributed frameworks?
3. The difference between Spring Cloud and Dubbo
Home Java JavaInterview questions Java interview questions-Dubbo

Java interview questions-Dubbo

Oct 28, 2020 pm 04:26 PM
dubbo java Interview questions

Java interview questions-Dubbo

Contents

(Video tutorial recommendation: java course)

1. Dubbo interview questions

2.Dubbo interview question answers analysis

1. Why use Dubbo?

2. What are the layers of Dubbo’s overall architecture design?

3. What communication framework is used by default? Are there any other options?

4. Services Is the call blocking?

5. What registration center is generally used? Are there any other options?

6. What serialization framework is used by default? What else do you know?

7. What is the principle behind the failure kicking of service providers?

8. How can the service go online without affecting the old version?

9. How to solve the problem of too long service call chain?

10. What are the core configurations?

11. What protocol does Dubbo recommend?

12. Can I directly connect to a certain service when there are multiple registrations for the same service?

13. Draw a flow chart of service registration and discovery?

14. How many solutions are there for Dubbo cluster fault tolerance?

15. Dubbo service is downgraded. How to retry after failure?

16. What problems did you encounter when using Dubbo?

17. Dubbo Monitor implementation principle?

18. What design patterns does Dubbo use?

19. How is the Dubbo configuration file loaded into Spring?

20. What is the difference between Dubbo SPI and Java SPI?

21. Does Dubbo support distributed transactions?

22. Can Dubbo cache results?

23. How can the service be compatible with old versions when it is online?

24. What are the packages that Dubbo must depend on?

25. What can the Dubbo telnet command do?

26. Does Dubbo support service downgrade?

27. How does Dubbo shut down gracefully?

28. What is the difference between Dubbo and Dubbox?

29. What is the difference between Dubbo and Spring Cloud?

30. Do you know other distributed frameworks?

3. The difference between Spring Cloud and Dubbo

4. Another microservice framework SpringCloud

SpringCloud component principle: Eureka, Feign, Ribbon, Hystrix, Zuul


1.Dubbo interview questions

1. Why use Dubbo?

2. What are the layers of Dubbo’s overall architecture design?

3. What communication framework is used by default? Are there any other options?

4. Services Is the call blocking?

5. What registration center is generally used? Are there any other options?

6. What serialization framework is used by default? What else do you know?

7. What is the principle behind the failure kicking of service providers?

8. How can the service go online without affecting the old version?

9. How to solve the problem of too long service call chain?

10. What are the core configurations?

11. What protocol does Dubbo recommend?

12. Can I directly connect to a certain service when there are multiple registrations for the same service?

13. Draw a flow chart of service registration and discovery?

14. How many solutions are there for Dubbo cluster fault tolerance?

15. Dubbo service is downgraded. How to retry after failure?

16. What problems did you encounter when using Dubbo?

17. Dubbo Monitor implementation principle?

18. What design patterns does Dubbo use?

19. How is the Dubbo configuration file loaded into Spring?

20. What is the difference between Dubbo SPI and Java SPI?

21. Does Dubbo support distributed transactions?

22. Can Dubbo cache results?

23. How can the service be compatible with old versions when it is online?

24. What are the packages that Dubbo must depend on?

25. What can the Dubbo telnet command do?

26. Does Dubbo support service downgrade?

27. How does Dubbo shut down gracefully?

28. What is the difference between Dubbo and Dubbox?

29. What is the difference between Dubbo and Spring Cloud?

30. Do you know other distributed frameworks?

2.Dubbo interview question answer analysis

1. Why use Dubbo?

With the further development of servitization, there are more and more services, and the calls and dependencies between services are becoming more and more complex. Service-oriented architecture (SOA) was born, and thus derived A series of corresponding technologies, such as a service framework that encapsulates service provision, service invocation, connection processing, communication protocols, serialization methods, service discovery, service routing, log output and other behaviors. In this way, the service governance framework for distributed systems emerged, and Dubbo was born.

2. What are the layers of Dubbo’s overall architecture design?

Interface service layer (Service): This layer is related to business logic, based on the business of provider and consumer Design the corresponding interface and implementation

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

Service proxy layer (Proxy): Transparent proxy of the service interface, which generates the client Stub and the server Skeleton of the service, with ServiceProxy as the center, and the extended interface is ProxyFactory

Service registration layer (Registry): Encapsulation service address Registration and discovery, centered on service URL, extended interfaces are RegistryFactory, Registry, RegistryService

Routing layer (Cluster):Encapsulates routing and load balancing of multiple providers, and bridges Registration center, with Invoker as the center, the extended interfaces are Cluster, Directory, Router and LoadBlancce

Monitoring layer (Monitor): RPC call number and call time monitoring, with Statistics as the center, extended The interfaces are MonitorFactory, Monitor and MonitorService

Remote call layer (Protocal):Encapsulates RPC calls, centered on Invocation and Result, and the extended interfaces are Protocol, Invoker and Exporter

Information exchange layer (Exchange): Encapsulation request response mode, synchronous to asynchronous. Centered on Request and Response, the extended interfaces are Exchanger, ExchangeChannel, ExchangeClient and ExchangeServer

Network transport layer (Transport):Abstract mina and netty are unified interfaces, centered on Message, extended The interfaces are Channel, Transporter, Client, Server and Codec

Data serialization layer (Serialize):Some reusable tools, the extended interfaces are Serialization, ObjectInput, ObjectOutput and ThreadPool

3. What communication framework is used by default? Are there any other options?

The netty framework and mina are also recommended by default.

4. Is the service call blocking?

The default is blocking and can be called asynchronously. If there is no return value, you can do this. Dubbo is a non-blocking implementation of parallel calls based on NIO. The client does not need to start multiple threads to complete parallel calls to multiple remote services. Compared with multi-threading, the overhead is smaller, and asynchronous calls will return a Future object.

5. What registration center is generally used? Are there any other options?

It is recommended to use Zookeeper as the registration center, as well as Redis, Multicast, and Simple registration centers, but they are not recommended.

6. What serialization framework is used by default? What else do you know?

It is recommended to use Hessian serialization, as well as Duddo, FastJson, and Java's own serialization.

7. What is the principle behind the failure kicking of service providers?

Service failure kicks out the temporary node principle based on zookeeper.

8. How can the service go online without affecting the old version?

Using multi-version development without affecting old versions.

9. How to solve the problem of too long service call chain?

Can be combined with zipkin to implement distributed service tracking.

10. What are the core configurations?

11. What protocol does Dubbo recommend?

#12. Can I directly connect to a certain service if there are multiple registrations for the same service?

You can directly connect point-to-point, just modify the configuration, or you can directly connect to a service through telnet.

(Recommendations for more related interview questions: java interview questions and answers)

13. Draw a flow chart of service registration and discovery?

14. How many solutions are there for Dubbo cluster fault tolerance?

#15. Dubbo service is downgraded. How to retry after failure?

You can set mock="return null" in dubbo:reference. The value of mock can also be changed to true, and then a Mock class is implemented in the same path as the interface. The naming rule is the "interface name Mock" suffix. Then implement your own downgrade logic in the Mock class

16. What problems did you encounter when using Dubbo?

The corresponding service cannot be found in the registration center. Check whether the service implementation class has added the @service annotation. Unable to connect to the registration center, check whether the corresponding test IP in the configuration file is correct

17 , Dubbo Monitor implementation principle?

The consumer side will first go through the filter chain before initiating the call; the provider side will also go through the filter chain first when receiving the request, and then perform the actual business logic processing. By default, there is a Monitorfilter in both the consumer and provider filter chains.

1. MonitorFilter sends data to DubboMonitor

2. DubboMonitor aggregates the data (statistics in 1min are aggregated by default) and temporarily stores them in ConcurrentMap statisticsMap, and then uses a The thread pool containing 3 threads (thread name: DubboMonitorSendTimer) calls SimpleMonitorService every 1 minute to traverse and send the statistical data in the statisticsMap. After each one is sent, the AtomicReference of the current Statistics is reset

3. SimpleMonitorService Stuff these aggregated data into the BlockingQueue queue (the queue is capitalized as 100000)

4. SimpleMonitorService uses a background thread (thread name: DubboMonitorAsyncWriteLogThread) to write the data in the queue to the file (the thread uses an infinite loop Written in the form)

5. SimpleMonitorService will also use a thread pool containing 1 thread (thread name: DubboMonitorTimer) to draw the statistical data in the file into a chart every 5 minutes

18. What design patterns does Dubbo use?

Dubbo framework uses a variety of design patterns in the initialization and communication process, which can flexibly control functions such as class loading and permission control.

Factory Mode

Provider will call the export method of ServiceConfig when exporting a service. There is a field in ServiceConfig:

private?static?final?Protocol?protocol?=
ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtensi
on();

Dubbo has a lot of this code. This is also a factory pattern, but the implementation class is obtained using the JDKSPI mechanism. The advantage of this implementation is that it is highly scalable. If you want to extend the implementation, you only need to add a file to the classpath, and there is zero code intrusion. In addition, like the Adaptive implementation above, it is possible to dynamically decide which implementation to call when calling. However, because this implementation uses a dynamic proxy, it will make code debugging more troublesome, and it is necessary to analyze the actual called implementation class.

Decorator Pattern

Dubbo 在啟動和調(diào)用階段都大量使用了裝飾器模式。以 Provider 提供的調(diào)用鏈為例,具體的調(diào)用鏈代碼是在 ProtocolFilterWrapper 的 buildInvokerChain 完成的,具體是將注解中含有 group=provider 的 Filter 實現(xiàn),按照 order 排序,最后的調(diào)用順序是:

EchoFilter?->?ClassLoaderFilter?->?GenericFilter?->?ContextFilter?->
ExecuteLimitFilter?->?TraceFilter?->?TimeoutFilter?->?MonitorFilter?->
ExceptionFilter

更確切地說,這里是裝飾器和責任鏈模式的混合使用。例如,EchoFilter 的作用是判斷是否是回聲測試請求,是的話直接返回內(nèi)容,這是一種責任鏈的體現(xiàn)。而像ClassLoaderFilter 則只是在主功能上添加了功能,更改當前線程的 ClassLoader,這是典型的裝飾器模式。

?觀察者模式

Dubbo 的 Provider 啟動時,需要與注冊中心交互,先注冊自己的服務,再訂閱自己的服務,訂閱時,采用了觀察者模式,開啟一個 listener。注冊中心會每 5 秒定時檢查是否有服務更新,如果有更新,向該服務的提供者發(fā)送一個 notify 消息,provider 接受到 notify 消息后,運行 NotifyListener 的 notify 方法,執(zhí)行監(jiān)聽器方法。

?動態(tài)代理模式

Dubbo 擴展 JDK SPI 的類 ExtensionLoader 的 Adaptive 實現(xiàn)是典型的動態(tài)代理實現(xiàn)。Dubbo 需要靈活地控制實現(xiàn)類,即在調(diào)用階段動態(tài)地根據(jù)參數(shù)決定調(diào)用哪個實現(xiàn)類,所以采用先生成代理類的方法,能夠做到靈活的調(diào)用。生成代理類的代碼是 ExtensionLoader 的 createAdaptiveExtensionClassCode 方法。代理類主要邏輯是,獲取 URL 參數(shù)中指定參數(shù)的值作為獲取實現(xiàn)類的 key。

19、Dubbo 配置文件是如何加載到 Spring 中的?

Spring 容器在啟動的時候,會讀取到 Spring 默認的一些 schema 以及 Dubbo 自定義的 schema,每個 schema 都會對應一個自己的 NamespaceHandler,NamespaceHandler 里面通過 BeanDefinitionParser 來解析配置信息并轉(zhuǎn)化為需要加載的 bean 對象!

20、Dubbo SPI 和 Java SPI 區(qū)別?

JDK SPI:

JDK 標準的 SPI 會一次性加載所有的擴展實現(xiàn),如果有的擴展吃實話很耗時,但也沒用上,很浪費資源。所以只希望加載某個的實現(xiàn),就不現(xiàn)實了

?DUBBO SPI:

1、對 Dubbo 進行擴展,不需要改動 Dubbo 的源碼

2、延遲加載,可以一次只加載自己想要加載的擴展實現(xiàn)。

3、增加了對擴展點 IOC 和 AOP 的支持,一個擴展點可以直接 setter 注入其

它擴展點。

4、Dubbo 的擴展機制能很好的支持第三方 IoC 容器,默認支持 Spring Bean。

21、Dubbo 支持分布式事務嗎?

目前暫時不支持,可與通過 tcc-transaction 框架實現(xiàn)

介紹:tcc-transaction 是開源的 TCC 補償性分布式事務框架

TCC-Transaction 通過 Dubbo 隱式傳參的功能,避免自己對業(yè)務代碼的入侵。

22、Dubbo 可以對結(jié)果進行緩存嗎?

為了提高數(shù)據(jù)訪問的速度。Dubbo 提供了聲明式緩存,以減少用戶加緩存的工作量

其實比普通的配置文件就多了一個標簽 cache="true"

23、服務上線怎么兼容舊版本?

可以用版本號(version)過渡,多個不同版本的服務注冊到注冊中心,版本號不同的服務相互間不引用。這個和服務分組的概念有一點類似。

24、Dubbo 必須依賴的包有哪些?

Dubbo 必須依賴 JDK,其他為可選。

25、Dubbo telnet 命令能做什么?

dubbo 服務發(fā)布之后,我們可以利用 telnet 命令進行調(diào)試、管理。Dubbo2.0.5 以上版本服務提供端口支持 telnet 命令

連接服務

telnet localhost 20880 //鍵入回車進入 Dubbo 命令模式。

查看服務列表

dubbo>ls
com.test.TestService
dubbo>ls?com.test.TestService
create
delete
query

· ls (list services and methods)

· ls : 顯示服務列表。

· ls -l : 顯示服務詳細信息列表。

· ls XxxService:顯示服務的方法列表。

· ls -l XxxService: Displays a list of service method details.

26. Does Dubbo support service downgrade?

To set mock="return null" in dubbo:reference. The value of mock can also be changed to true, and then a Mock class is implemented in the same path as the interface. The naming rule is the "interface name Mock" suffix. Then implement your own downgrade logic in the Mock class

27. How does Dubbo shut down gracefully?

Dubbo uses JDK's ShutdownHook to complete graceful shutdown. Therefore, if you use kill -9 PID and other forced shutdown instructions, graceful shutdown will not be executed. It will only be executed when kill PID is used.

28. What is the difference between Dubbo and Dubbox?

Dubbox is an extension project made by Dangdang based on Dubbo after Dubbo stopped maintaining. For example, it added services that can be called by Restful, updated open source components, etc.

29. What is the difference between Dubbo and Spring Cloud?

Based on the various elements of the microservice architecture, let’s see what support Spring Cloud and Dubbo provide.

The microservice architecture built using Dubbo is like assembling a computer. We have a high degree of freedom of choice in each link, but the final result is likely to be due to poor quality of a memory. It always makes people feel uneasy if it turns off, but if you are an expert, then these are not problems; and Spring Cloud is like a brand machine. Under the integration of Spring Source, it has done a lot of compatibility tests to ensure The machine has higher stability, but if you want to use something other than non-original components, you need to have a sufficient understanding of its basics.

30. Do you know other distributed frameworks?

Others include spring's spring cloud, facebook's thrift, twitter's finagle, etc.

3. The difference between Spring Cloud and Dubbo

##Dubbo-monitorSpring Boot Admin##Data flowNoneSpring Cloud Stream##Batch Task##......The biggest difference :Spring Cloud abandons Dubbo's RPC communication and adopts HTTP-based REST method. Strictly speaking, both methods have their own pros and cons. Although to a certain extent, the latter sacrifices the performance of service calls, it also avoids the problems caused by native RPC mentioned above. Moreover, REST is more flexible than RPC. The service provider and the caller only rely on a contract, and there is no strong dependence at the code level. This is more appropriate in a microservice environment that emphasizes rapid evolution. 4. Another microservice framework SpringCloudSpringCloud component principles: Eureka, Feign, Ribbon, Hystrix, Zuul

Dubbo

Spring Cloud

Service Registration Center

Zookeeper

Spring Cloud Netflix Eureka

Service Calling method

##RPC

##Circuit breaker

Imperfect

Spring Cloud Netflix Hystrix

Service Gateway

None

Spring Cloud Netflix Zuul

Distributed Configuration

None

Spring Cloud Config

Service Tracking

None

##Spring Cloud Sleuth

##Message Bus

None

Spring Cloud Bus

None

Spring Cloud Task

......

......

Please read the previous issues:

Related recommendations:

Getting started with java

The above is the detailed content of Java interview questions-Dubbo. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72
VSCode settings.json location VSCode settings.json location Aug 01, 2025 am 06:12 AM

The settings.json file is located in the user-level or workspace-level path and is used to customize VSCode settings. 1. User-level path: Windows is C:\Users\\AppData\Roaming\Code\User\settings.json, macOS is /Users//Library/ApplicationSupport/Code/User/settings.json, Linux is /home//.config/Code/User/settings.json; 2. Workspace-level path: .vscode/settings in the project root directory

How to handle transactions in Java with JDBC? How to handle transactions in Java with JDBC? Aug 02, 2025 pm 12:29 PM

To correctly handle JDBC transactions, you must first turn off the automatic commit mode, then perform multiple operations, and finally commit or rollback according to the results; 1. Call conn.setAutoCommit(false) to start the transaction; 2. Execute multiple SQL operations, such as INSERT and UPDATE; 3. Call conn.commit() if all operations are successful, and call conn.rollback() if an exception occurs to ensure data consistency; at the same time, try-with-resources should be used to manage resources, properly handle exceptions and close connections to avoid connection leakage; in addition, it is recommended to use connection pools and set save points to achieve partial rollback, and keep transactions as short as possible to improve performance.

Mastering Dependency Injection in Java with Spring and Guice Mastering Dependency Injection in Java with Spring and Guice Aug 01, 2025 am 05:53 AM

DependencyInjection(DI)isadesignpatternwhereobjectsreceivedependenciesexternally,promotingloosecouplingandeasiertestingthroughconstructor,setter,orfieldinjection.2.SpringFrameworkusesannotationslike@Component,@Service,and@AutowiredwithJava-basedconfi

How to work with Calendar in Java? How to work with Calendar in Java? Aug 02, 2025 am 02:38 AM

Use classes in the java.time package to replace the old Date and Calendar classes; 2. Get the current date and time through LocalDate, LocalDateTime and LocalTime; 3. Create a specific date and time using the of() method; 4. Use the plus/minus method to immutably increase and decrease the time; 5. Use ZonedDateTime and ZoneId to process the time zone; 6. Format and parse date strings through DateTimeFormatter; 7. Use Instant to be compatible with the old date types when necessary; date processing in modern Java should give priority to using java.timeAPI, which provides clear, immutable and linear

Understanding the Java Virtual Machine (JVM) Internals Understanding the Java Virtual Machine (JVM) Internals Aug 01, 2025 am 06:31 AM

TheJVMenablesJava’s"writeonce,runanywhere"capabilitybyexecutingbytecodethroughfourmaincomponents:1.TheClassLoaderSubsystemloads,links,andinitializes.classfilesusingbootstrap,extension,andapplicationclassloaders,ensuringsecureandlazyclassloa

Google Chrome cannot open local files Google Chrome cannot open local files Aug 01, 2025 am 05:24 AM

ChromecanopenlocalfileslikeHTMLandPDFsbyusing"Openfile"ordraggingthemintothebrowser;ensuretheaddressstartswithfile:///;2.SecurityrestrictionsblockAJAX,localStorage,andcross-folderaccessonfile://;usealocalserverlikepython-mhttp.server8000tor

Comparing Java Frameworks: Spring Boot vs Quarkus vs Micronaut Comparing Java Frameworks: Spring Boot vs Quarkus vs Micronaut Aug 04, 2025 pm 12:48 PM

Pre-formanceTartuptimeMoryusage, Quarkusandmicronautleadduetocompile-Timeprocessingandgraalvsupport, Withquarkusoftenperforminglightbetterine ServerLess scenarios.2.Thyvelopecosyste,

Understanding Network Ports and Firewalls Understanding Network Ports and Firewalls Aug 01, 2025 am 06:40 AM

Networkportsandfirewallsworktogethertoenablecommunicationwhileensuringsecurity.1.Networkportsarevirtualendpointsnumbered0–65535,withwell-knownportslike80(HTTP),443(HTTPS),22(SSH),and25(SMTP)identifyingspecificservices.2.PortsoperateoverTCP(reliable,c

See all articles