InterviewSolution
| 1. |
How does Eureka Server work? |
|
Answer» There are two main components in Eureka project: eureka-server and eureka-client.
The central server (ONE PER zone) that acts as a service registry. All microservices register with this eureka server during app bootstrap.
Eureka also comes with a Java-based client component, the eureka-client, which makes interactions with the service MUCH easier. The client also has a built-in load balancer that does basic round-robin load balancing. Each microservice in the distributed ecosystem much include this client to communicate and register with eureka-server.
There is usually one eureka server cluster per REGION (US, Asia, Europe, Australia) which knows only about instances in its region. Services register with Eureka and then send heartbeats to renew their leases every 30 seconds. If the service can not renew their lease for a few times, it is taken out of server registry in about 90 seconds. The registration information and the renewals are replicated to all the eureka nodes in the cluster. The CLIENTS from any zone can look up the registry information (happens every 30 seconds) to locate their services (which could be in any zone) and make remote calls. Eureka clients are built to handle the failure of one or more Eureka servers. Since Eureka clients have the registry cache information in them, they can operate reasonably well, even when all of the eureka servers go down. |
|