This is my 20th day of the August Genwen Challenge

This series code address: github.com/HashZhang/s…

Eureka is currently being updated to version 1.x, but there should be no new features, just maintenance of existing features, upgrades and compatibility with required dependencies. Eureka 2.x is stillborn. But that doesn’t mean Eureka isn’t working. If you need a registry that is simple and easy to deploy, Eureka is also a good choice. In a cloud service environment, where virtually all instance addresses and microservice names are constantly changing, there is little need for the persistence features that Eureka lacks. Eureka is still a good choice when your cluster is small to medium size (less than 1000 nodes). When your cluster is large, Eureka’s synchronization mechanism may limit its performance.

Eureka’s design is small, with no complex synchronization mechanisms (such as Nacos based on Raft and Zookeeper based on Zab), and no complex persistence mechanisms. The cluster relationship simply forwards incoming client requests to other Eureka instances within the cluster. Eureka itself also only functions as a registry, unlike other types of registries that combine registry and configuration centers, such as Consul and NACos.

We ignore all AWS terminology and configuration and logic here.

Terminology in Eureka:

  1. Eureka instance: Every instance registered to Eureka is an Eureka instance.
  2. Eureka instance status: UP (available to process requests), DOWN (unable to process requests due to health check failure), STARTING (unable to process requests due to STARTING), OUT_OF_SERVICE (offline), UNKNOWN (UNKNOWN status).
  3. Eureka server: As a registry, it mainly provides instance management functions (processing instance registration request, processing instance cancellation request, processing instance heartbeat request, internal processing instance expiration request), instance query functions (various interface for querying instance information, For example, get instance list by AppName, instance information by instance ID, etc.)
  4. Eureka server cluster: a cluster of Eureka servers. Each Eureka server is configured with an area and an availability zone. Client requests received by the Eureka server are forwarded to other Eureka servers in the same area. Eureka servers in different areas are synchronized by timed pull.
  5. Eureka client: The client that requests the Eureka server. Encapsulate send instance register request, instance cancel request, and instance heartbeat Renew request.
  6. VIP (or Virtual Hostname): There are two ways to get instances in Eureka, one by service name and the other by VIP. Each instance has a service name, and a VIP. The index method in Eureka server is the key index of the service name. We can also get related instances through VIP string matching by traversing all instance information. In Spring Cloud, an instance’s VIP, SVIP (Secure VIP), and service name arespring.application.nameSpecifies the name of the service.

First, Service A sends A Register request through Eureka Client to Eureka Server 1 in the same availability area. Renew Eureka Server 1 by sending a heartbeat request to Renew the request. These requests are processed and forwarded to Eureka Server 2 and Eureka Server 3 in other clusters. Eureka Server 2 and Eureka Server 3 do not forward the received Eureka Server 1 A forwarded request. Service B and Service C then use Eureka to get the location of Service A and call Service A.

For microservices that are not queried locally, the Eureka Server obtains them from the Eureka Server of the remote Region. For example, Service D is not queried locally. The Eureka Server returns an instance of Service D of the remote Region. Since Service A exists locally, an instance of Service A of the remote Region will not be returned. In addition, the local Region is the Service list of the remote Region that is pulled periodically. The local Region is not queried every time.

In general, microservices are called to each other, not through Eureka and not involving the Eureka client, but through the load balancer, which we’ll talk about later.

This section examines Eureka’s architecture and its core concepts in detail. In the next section, we’ll start with the instance configuration of Eureka, our microservices registry.

Wechat search “my programming meow” public account, a daily brush, easy to improve skills, won a variety of offers: