springcloud summary

1. Introduction

springcloud provides a one-stop microservice solution

Two, five major components

1. Service Registration and Discovery

Netflix Eureka

  1. Follow API principles

  2. Adopt CS architecture

    server: Service registry, store the list of available service nodes
    client: connect to server, maintain heartbeat connection, default cycle 30s, built-in polling load balancer

  3. Self-protection mechanism

    Function: The
    microservice will initiate a registration request only when it is started, to avoid accidental deletion by the server when the microservice itself is healthy due to network failures

    Triggering condition:
    When a large number of instance heartbeats are lost in a short time, the microservice information is still saved and will not be deleted from the registry immediately (more than 85% within 15 minutes)

    Turn off (not recommended):
    eureka.server.enable-selt-preservation=false

    In the testing phase, when the microservice is frequently restarted and released, the self-protection mechanism may be triggered, and the request may go to the old instance, resulting in a request error

  4. Cluster construction

2. Load Balancing (LoadBalancer)

Method 1: Ribbon:

Integrate the logic into the consumer and call it through the microservice name

Method 2: Feign:

Integrate logic into the provider and call through interfaces and annotations, which is more in line with development habits

3. Service Gateway

  • Netflix Zuul : routing, filtering
  • Spring Cloud Gateway

It can be regarded as an upgraded version and replacement of Zuul 1.x, using Netty to implement asynchronous IO earlier than Zuul 2, thus realizing a simple, more efficient API than Zuul 1.x and tightly working with Spring Cloud Gateway

4. Fuse

Netflix Hystrix

Function: to
ensure that when a certain dependent environment fails, cascading failures are avoided, and the resilience of the distributed system is improved. The
default is that if 20 calls fail within 5 seconds, the fuse mechanism will be activated

5. Distributed configuration

Spring Cloud Config

Provide centralized external configuration for microservices

Three, reference materials

Guess you like

Origin blog.csdn.net/dabaoting/article/details/114501853