Microservices, the core foundation of microservices, and common microservice frameworks

Microservices, the core foundation of microservices, and common microservice frameworks

background

Microservices are increasingly used in the development field because developers are committed to creating larger and more complex applications. These applications are better developed and managed as a combination of small services that can work together to achieve Larger application scope functions. Tools are on the rise to meet the need to think and build applications using a piece-by-piece approach, which, frankly, is less incredible than considering the entire application at once. ( DZone, Java microservices )

What is a microservice?

Microservices is a service-oriented architectural style (one of the most important skills for Java developers) in which applications are built as a collection of different small services rather than entire applications. Instead of a single application, you can create multiple independent applications using different coding or programming languages. These applications can run independently. Large and complex applications can be composed of simpler and independent programs that can be executed by themselves. These smaller programs are combined to provide all the functions of a large monolithic application. ( DZone, Java microservices )

What are the benefits of microservices?

There are several benefits to using microservices. First, because these smaller applications do not rely on the same coding language, developers can use the programming language they are most familiar with. This helps developers to propose programs faster with lower cost and fewer errors. Agility and low cost can also come from being able to reuse these smaller programs on other projects, thereby increasing efficiency. ( DZone, Java microservices )

Core foundation of microservices

Core knowledge of microservices: gateway, service discovery and registration (registration center), configuration center, link tracking, load balancer, circuit breaker.

  1. Gateway: route forwarding + filter
  2. Service registry: information maintenance of the caller (the role service that calls other service information) and the called party (the role service that calls the information by other services). (Each service can be the caller or the callee)
  3. Configuration Center: Manage configuration and dynamically update configuration, so that when you change the configuration of business services, you only need to update the configuration center to dynamically update the business service configuration.
  4. Link tracking: Analyze the time consumed by calling the link. A single business may involve the call of information between multiple services, and link tracking can analyze the time-consuming call between services. (Link: call route between services)
  5. Load balancer: The service load is too large, and the load is distributed.
  6. Fuse: protect yourself and the called party. When the callee encounters an unexpected situation, such as hangs up. The caller does not respond for a long time during the call, so that the call is convenient and no longer is called, which prevents the caller from being in the request state during the call and the system is stuck.
Common microservice framework

Concept:
consumer: caller
provider: called party
An interface generally plays two roles (but not at the same time)

Framework 1. Dubbo: zookeeper + dubbo + springmvc/springboot
Communication method: rpc (more efficient than http) Advantages and disadvantages of HTTP and RPC
Registration center: zookeeper/redis
Configuration center: diamond

Frame 2 : springcloud: family bucket + embedded third-party components
Communication method: http restful
registration center: eruka/consul
configuration center: config
gateway: zuul
distributed tracking system: sleuth+zipkin

The communication method used by Dubbo is rpd, and the connection speed is fast. (E-commerce system, it is recommended to use most of the spike activities), the shortcomings are insufficient and the components need to be explored by themselves (requires personnel and economy).
The Springcloud communication method is http, which requires a 3-way handshake, so the connection data is slower (recommended for low concurrency), and the advantage components are complete (we will use it later).
Insert picture description here
The above are the knowledge points that I personally understand. The content is not very detailed. If you understand the problem, you must correct it!

Guess you like

Origin blog.csdn.net/qq_31142237/article/details/89791789