Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common interview questions in SpringCloud

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what are the common interview questions in SpringCloud". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. What is Microservices?

A single lightweight service is generally a separate microservice. Microservices focus on the implementation of a certain function, such as login system, which only focuses on the implementation of user login functions. They focus on a single responsibility, out-of-the-box, and can run independently. Microservice architecture system is a distributed system, divided into service unit modules according to business, to solve the shortcomings of a single system, to meet increasingly complex business requirements.

Martin Fowler: Right now, there is no single, standard definition of the microservices industry. But generally speaking, microservices architecture is an architectural pattern or style that advocates dividing a single application into a set of small services. Each service runs in its own independent process, coordinating and coordinating with each other to provide ultimate value to users. Lightweight communication between services. Each service is built around a specific business and can be deployed independently into production environments, etc. In addition, unified, centralized service management mechanisms should be avoided as much as possible.

In layman's terms:

A microservice is a service application with a single independent responsibility. In intellij idea tool, it is a separate module developed with maven. Specifically, it is a small module developed with springboot to deal with a single professional business logic. A module only does one thing.

Microservices emphasize the size of the service, focus on a certain point, specifically solve a certain problem/landing corresponding to a service application, can be regarded as an idea inside a module.

For example, if you go to the hospital: your teeth are uncomfortable, then you go to the dentist. Your headache, then you go to brain surgery. Each department is a microservice, and a function is a service.

2. How do microservices communicate independently?

Synchronous communication: dobbo via RPC remote procedure calls, springcloud via REST interface json calls, etc.

Asynchronous: message queues, such as RabbitMq, ActiveM, Kafka, etc.

3. What is the difference between SpringCloud and Dubbo?

First, they are distributed management frameworks. Dubbo is a binary transmission that takes up a bit less bandwidth. SpringCloud is http transmission, bandwidth will be a little more, while using http protocol will generally use JSON messages, consumption will be greater. Dubbo is difficult to develop, and the jar package it relies on has many problems that large-scale projects cannot solve. SpringCloud inheritance to third parties can be generated in one click and integrated naturally. SpringCloud interface protocols are loose and require strong administrative measures to limit interface out-of-order upgrades.

The biggest difference: Spring Cloud ditched Dubbo RPC communication in favor of HTTP-based REST. Strictly speaking, both methods have their advantages and disadvantages. While the latter sacrifices service invocation performance to some extent, it also avoids the problems with native RPC mentioned above. Moreover, REST is more flexible than RPC, and the dependencies of service providers and callers rely only on a paper contract, and there is no strong dependency at the code level, which is more appropriate in a microservice environment that emphasizes rapid evolution.

4. What is the relationship between SpringBoot and SpringCloud?

SpringBoot: Focus on fast and convenient development of individual microservices (focus on micro);SpringCloud: focus on the overall microservice coordination governance framework, combining and managing individual microservices developed by SpringBoot (focus on macro); SpringBoot can be used independently of SpringCloud, but SpringCloud cannot be used independently of SpringBoot, belonging to dependency relationship.

5. What is a fuse? What is service degradation?

A service fuse acts like a fuse in our home. When a service is unavailable or response timeout occurs, in order to prevent avalanche of the whole system, the call to the service is temporarily stopped.

Service degradation is based on the load situation of the whole system. For some cases where the load is relatively high, in order to prevent some functions (business scenarios) from overload or slow response, it temporarily abandons requests for some non-core interfaces and data, and directly returns a fallback error handling information prepared in advance. Thus, although it provides a lossy service, it guarantees the stability and availability of the entire system.

6. What are the advantages and disadvantages of microservices? Tell me about the pitfalls you encountered in your project.

Advantages: Loose coupling, focus on a single business function, no development language, reduced team size. In the development process, there is no need to understand multiple businesses, only focus on current functions, convenient concentration, small and refined functions. Microservice one function is damaged, the impact on other functions is not too big, can quickly locate the problem. Microservices focus only on the current business logic code and do not mix with html, css, or other interfaces. Technology can be flexibly matched, and independence is more comfortable.

Disadvantages: As the number of services increases, management is complex, deployment is complex, servers need to increase, service communication and invocation pressure increases, operation and maintenance engineer pressure increases, human resources increase, system dependency increases, data consistency, performance monitoring.

7. Both eureka and zookeeper can provide service registration and discovery functions. What is the difference between the two?

Zookeeper is CP principle, strong consistency and partition fault tolerance. eureka is AP principle availability and partition fault tolerance. zookeeper When the master node fails, zk will reselect the master node from the remaining nodes, which takes too long. Although it can be recovered eventually, the service will be unavailable during the selection of the master node, which is intolerable. Each node of eureka is equal. If one node hangs, the other nodes will still maintain normal service.

8. What do you know about microservices? List one or two.

9. What is Microservices Architecture?

If you understand what microservices are, then you basically understand the microservices architecture. Microservices architecture is the management and integration of microservices applications. Microservices architecture relies on microservices and is built on top of microservices. For example, we have already listed what microservices are. In a hospital, each department is an independent microservice, so this hospital is a large-scale microservice architecture, just like the dean can manage the following departments. Microservices architecture is primarily about this functionality.

"SpringCloud common interview questions what" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report