What is Eureka service, Eureka Client, Eureka instance and Eureka server

Definitions


Eureka Server

The discovery server. It contains a registry of services and a REST api that can be used to register a service, deregister a service, and discover the location of other services.

Eureka Service

Any application that can be found in the Eureka Server's registry and is discoverable by others. A service has a logical identifier sometimes called a VIP, sometimes called a "service id", that can refer to one or more instances of the same application.

Eureka Instance

Any application that registers itself with the Eureka Server to be discovered by others

Eureka Client

Any application that can discover services

Questions


How can an application be both a Eureka Instance and a Eureka Client?

Applications often need to make themselves available for use by others (so they are an instance) while at the same time they need to discover other services (so they are a client).

Does a Eureka Client have to be a Eureka Instance?

No. Sometimes an application has nothing to offer and is only a caller of other services. Via configuration (eureka.client.register-with-eureka=false), you can tell it not to register itself as an instance. It is therefore only a Eureka Client as it only discovers other services.


I'd say these terms are used a bit ambiguously, here's what I think they mean in the article:

  • Eureka Client: it can be a microservice that is ready to work so it registers itself to the Eureka server e.g. an API for some app, or some application that goes to the server and asks for directions to a specific microservice.

  • Eureka Instance: a single instance of a microservice (you can add more instances of the same microservice as your load grows i.e. horizontal scaling).

  • Eureka Service: looks like when you register a microservice as an Eureka Client, you obtain an Eureka Service registered by an ID.

  • Eureka Server: a server where microservices can register themselves so others can discover them.


About the update you added:

Eureka Instance should not be confused with Eureka Service. Eureka Service refers to the group of microservice instances registered to the Eureka Server that provide the same service.

About that @EnableEurekaClient annotation, it tells the following to the framework: hi there Spring, I am an instance of microservice X, so please register me to the Eureka Server (with eureka.instance.* properties), and I also want to discover other services, so create the necessary discovery client bean for me (with eureka.client.* properties).

In summary, this annotation named @EnableEurekaClient does both things, maybe that's where the confusion comes from. But Instance and Client are indeed different concepts, even though they are used somewhat interchangeably in the article.


enter image description here

I think they look like this pic.

  1. A Eureka client registers to a Eureka Server.
  2. Because a Eureka Instance registers to Eureka Server, so it is a client.
  3. Because a Eureka Service offers api to others, so it can be discovered by others, so it is a Instance.