Help the 2020 interview! After reading this wave of microservice interview questions, "10 take 9 stable"

Preface

Microservices is the most popular application architecture at the moment. Together with container cloud and DevOps, it is called the Three Musketeers of the New Era. It helps us resolve the pressure of product iteration caused by rapid business development, and allows us to freely choose the technology stack that best suits our team. Allow the system to carry the access of a large number of Internet users. In recent years, driven by the efforts of vendors, communities, and users, theories and products related to microservices have become more mature. Building microservices from scratch has become very simple and fast. So are we entering the era of microservices?

It takes time for the evolution of microservices to mature, and it takes time for us to be familiar with this set of new technologies. In addition, there are a large number of single applications running in the computer room, and they need to be maintained and upgraded. History goes into battle easily. These monolithic applications are also responsible for the company's core business. All overturned and shocked reconstruction is not advisable. The investment cycle is long and the risks are completely uncontrollable.

We must learn the skills of changing tires while driving, promote the transformation of microservices without affecting the existing network business, let the old system glow with new vitality, and continue to support the development of the business in the next decade.

topic

1. What do you know about microservices?

Microservices, also known as microservices architecture, is an architectural style that builds applications as a collection of small autonomous services modeled on business domains.

In layman's terms, you have to see how bees build their honeycombs by aligning hexagonal wax cells. They started by using small parts of various materials and continued to build a large beehive from them. These cells form a pattern, creating a strong structure that holds specific parts of the honeycomb together. Here, each cell is independent of another cell, but it is also related to other cells. This means that damage to one cell does not damage other cells, so bees can rebuild these cells without affecting the intact hives.
Insert picture description here

                                                图 1:微服务的蜂窝表示 – 微服务访谈问题

Please refer to the picture above. Here, each hexagonal shape represents a separate service component. Similar to the work of bees, each agile team builds individual service components using available frameworks and selected technology stacks. Just like in a beehive, each service component forms a powerful microservice architecture to provide better scalability. In addition, agile teams can deal with the issues of each service component individually, with no or minimal impact on the entire application.

2. What are the advantages of microservice architecture?

Insert picture description here

                                               图 2:微服务的 优点 – 微服务访谈问题

· Independent development-all microservices can be easily developed according to their functions

· Independent deployment-based on their services, they can be deployed separately in any application

· Fault isolation-even if a service of the application does not work, the system can continue to run

· Hybrid technology stack-different languages ​​and technologies can be used to build different services of the same application

· Granular scaling-a single component can be scaled as needed, no need to scale all components together

3. What are the characteristics of microservices?
Insert picture description here

                                                图 3:微服务的 特点 – 微服务访谈问题

· Decoupling – The services within the system are largely separated. Therefore, the entire application can be easily built, changed and extended

· Componentization-microservices are viewed as independent components that can be easily replaced and upgraded

· Business capabilities-microservices are very simple and focus on a single function

· Autonomy-developers and teams can work independently of each other, thereby increasing speed

· Continuous delivery-system automation through software creation, testing and approval, allowing frequent software releases

· Responsibility-Microservices do not focus on the application as a project. Instead, they view the application as the product they are responsible for

· Decentralized governance-the focus is on using the right tools to do the right work. This means that there is no standardized model or any technological model. Developers are free to choose the most useful tools to solve their problems

· Agile-Microservices support agile development. Any new features can be quickly developed and discarded again

4. What are the best practices for designing microservices?

The following are the best practices for designing microservices:

Insert picture description here

                                               图 4:设计微服务的最佳实践 – 微服务访谈问题

5. How does the microservice architecture work?

The microservice architecture has the following components:
Insert picture description here

                                                图 5:微服务 架构 – 微服务面试问题

· Client-Different users from different devices send requests.

· Identity Provider – Verifies the identity of the user or customer and issues security tokens.

· API Gateway-handle client requests.

· Static content-contains all the content of the system.

· Management-balance services on nodes and identify failures.

· Service discovery – a guide to finding communication paths between microservices.

· Content Delivery Network-a distributed network of proxy servers and their data centers.

· Remote Service – Enable remote access information residing on the IT equipment network.

6. What are the advantages and disadvantages of the microservice architecture?

  • Disadvantages of the microservice architecture:
    increased troubleshooting challenges, increased delays due to remote calls, increased workload for configuration and other operations, difficulty in keeping transactions secure, difficulty in tracking data across various boundaries, and difficulty in coding between services
  • The advantages of microservice architecture:
    free use of different technologies, each microservice focuses on a single function, supports a single deployable unit, allows frequent software releases, ensures the security of each service, and multiple services are developed and deployed in parallel

7. Monolithic, what is the difference between SOA and microservice architecture?
Insert picture description here

                                                图 6: 单片 SOA 和微服务之间的比较 – 微服务访谈问题

· The monolithic architecture is similar to a large container, in which all software components of the application are assembled and tightly packaged.

· A service-oriented architecture is a collection of mutually communicating services. Communication can involve simple data transfer, or it can involve two or more services that coordinate certain activities.

· Microservice architecture is an architectural style that builds applications as a collection of small autonomous services modeled on business domains.

8. What challenges do you face when using microservice architecture?

It sounds easy to develop some smaller microservices, but the challenges that are often encountered when developing them are as follows.

· Automated components: difficult to automate because there are many smaller components. Therefore, for each component, we must follow the various stages of Build, Deploy and Monitor.

· Susceptibility: Maintaining a large number of components together becomes difficult to deploy, maintain, monitor and identify problems. It needs to have good perception around all components.

· Configuration management: Sometimes it becomes difficult to maintain the configuration of components in various environments.

· Debug: It is difficult to find every service that is wrong. Maintaining centralized logging and dashboards to debug issues is critical.

9. What is the main difference between SOA and microservice architecture?

The main differences between SOA and microservices are as follows:

  • SOA:
    Follow the "as much sharing as possible" architectural approach, the importance lies in business functions, they have common governance and standards, use Enterprise Service Bus (ESB) for communication, they support multiple message protocols, multithreading, and more The overhead to handle I/O, maximize the reusability of application services, more use of traditional relational databases, system changes need to modify the overall, DevOps/Continuous
    Delivery is becoming popular, but it is not yet mainstream
  • Microservices:
    follow the architectural approach of "sharing as little as possible", the importance lies in the concept of "bounded background", they are more focused on cooperation with people and other free choices, simple consumption systems, and they use light weight Level protocol, such as HTTP/REST, etc. Single thread usually uses the Event Loop function for non-locking I/O processing, focuses on decoupling, and uses modern relational databases more. System changes are to create a new service and focus on DevOps/continuous delivery.

10. What are the characteristics of microservices?

You can list the characteristics of microservices as follows:
Insert picture description here

                                               图 7:微服务的特征 – 微服务访谈问题

11. What is domain-driven design?

Insert picture description here

                                                图 8: DDD 原理 – 微服务面试问题

12. Why do we need Domain Driven Design (DDD)?

Insert picture description here

                                               图 9:我们需要 DDD 的因素 – 微服务面试问题

13. What is the ubiquitous language?

If you must define a ubiquitous language (UL), then it is a universal language used by developers and users of a specific domain, through which the domain can be easily interpreted.

Ubiquitous language must be very clear so that it puts all team members on the same page and translates in a way that the machine can understand.

14. What is cohesion?

The degree to which the elements within the module belong is considered cohesion.

15. What is coupling?

A measure of the strength of dependencies between components is considered coupling. A good design is always considered to have high cohesion and low coupling.

16. What is REST / RESTful and what is its purpose?

Representational State Transfer (REST)/RESTful Web service is an architectural style that helps computer systems communicate over the Internet. This makes microservices easier to understand and implement.

Microservices can be implemented with or without RESTful APIs, but it is always easier to build loosely coupled microservices using RESTful APIs.

17. What do you know about Spring Boot?

In fact, with the addition of new functions, springs have become more and more complex. If you must start a new spring project, you must add the build path or add maven dependencies, configure the application server, and add the spring configuration. So everything must start from the beginning.

Spring Boot is the solution to this problem. Using spring boot can avoid all boilerplate code and configuration. Therefore, basically think of yourself as if you are baking a cake, spring is like the ingredients needed to make a cake, and spring boots are the complete cake in your hands.

Insert picture description here

                                                图 10: Spring Boot 的因素 – 微服务面试问题

18. What is a Spring boot actuator?

The Spring Boot executor provides restful Web services to access the current state of running applications in the production environment. With the help of the actuator, you can check various indicators and monitor your application.

19. What is Spring Cloud?

According to Spring Cloud's official website, Spring Cloud provides developers with tools to quickly build some common patterns in distributed systems (such as configuration management, service discovery, circuit breakers, intelligent routing, leader election, distributed sessions, cluster status).

20. What problems does Spring Cloud solve?

When using Spring Boot to develop distributed microservices, the problems we face are rarely solved by Spring Cloud.

· Complexity associated with distributed systems-including network issues, latency overhead, bandwidth issues, security issues.

· Ability to handle service discovery-Service discovery allows processes and services in the cluster to find and communicate with each other.

· Solve redundancy problems-Redundancy problems often occur in distributed systems.

· Load Balancing-Improve workload distribution across multiple computing resources (such as computer clusters, network links, central processing units).

· Reduce performance problems-reduce performance problems caused by various operating overheads.

Conclusion and follow-up

With the gradual maturity of the distributed technology stack, in recent years, more and more systems and fields have been designed with microservice architecture in the industry, including finance, e-commerce, live broadcast, logistics, marketing, procurement, manufacturing, etc., both in the Internet field and traditional field.
Recently, it is the best time to find a job. I have collected some interview questions from major manufacturers and the latest data this year (2020). The following are some screenshots of the data (all data have been integrated into documents, and pdf compressed and packaged) .
If you have a friend in need, you can click here to get information, code: qf

Insert picture description here

Guess you like

Origin blog.csdn.net/SpringBoot_/article/details/108579037