Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the role of Zookeeper vs Eureka for microservices?

I am going to implement the orchestration of a set of microservices in my application. Two widely using tools I found Apache Zookeeper and Netflix Eureka.

Can anyone please give a comparison based on fundamental differences, those two services have?

Is there any other powerful tool?

like image 989
Supun Wijerathne Avatar asked Feb 06 '18 05:02

Supun Wijerathne


People also ask

What is the role of a ZooKeeper in Microservices?

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications.

What is the benefit of Eureka and ZooKeeper?

Because Eureka is built explicitly for service discovery, it provides a client library that provides functionality such as service heartbeats, service health checks, automatic publishing, and refreshing caches. With ZooKeeper, you would have to implement all of these things yourself.

What is the use of Eureka in Microservices?

Eureka Server is an application that holds the information about all client-service applications. Every Micro service will register into the Eureka server and Eureka server knows all the client applications running on each port and IP address. Eureka Server is also known as Discovery Server.

Is ZooKeeper a service registry?

Check out Curator Discovery (part of Apache Curator), a Zookeeper-based service registry written in Java. In SOA/distributed systems, services need to find each other. i.e. a web service might need to find a caching service, etc.


2 Answers

I am going to implement the orchestration of a set of microservices in my application.

This is a hard problem to solve by yourself. You are probably better off using an existing orchestration system (see below).

Is there any other powerful tool?

You should look into kubernetes, which seems to be the standard in orchestration these days. It has many additional benefits (enable scalability, self-healing, etc) and is widely used in production today. See the following links:

  • Kubernetes webpage
  • Article

Regarding comparing zookeeper, eureka and kubernetes:

  • Zookeeper is a distributed key value store. It can be used as the basis to implement service discovery (similar to etcd).
  • Eureka is primarily a service locator used as part of Netflixes load balancers and failover(allow finding the right service targets for distributing client calls to members of an application cluster).
  • Kubernetes is a container orchestration solution that includes the deployment, discovery and self-healing of services. For a complete list of features, check the link above. The service discovery in kubernetes is based on dns in the virtual network it spans and builds upon etcd.
  • Consul (mentioned in the other answer) is a service discovery framework with a REST interface and some additional features (Health Checking, Service Segmentation,..). It has its own internal distributed key value store that can be used as well.
like image 146
Oswin Noetzelmann Avatar answered Oct 03 '22 03:10

Oswin Noetzelmann


Another tool might be Consul.

Eureka is mostly a service discovery tool and mostly designed to use inside AWS infrastructure.

Zookeeper is a common-purpose distributed key/value store which can be used for service-discovery in conjunction with curator-x-discovery framework

Here is a brief overview of service-discovery solutions

You can also find comparison of Consul vs Eureka vs Zookeeper here.

Although Consul is as well as zookeeper - can be used not only for discovery but as a key/value store, the advantages of Consul are cool service discovery features out of the box

  1. DNS out of the box
  2. convenient RESTful API
  3. HealthCheck API out of the box

Also consul has more distributed nature: agents are installed on all service VMs and hence the system has higher availability than zookeeper. Be aware that consul system has low coupling between datacenters.

Zookeeper is mature, but too generic. So you can use zookeeper not only for service discovery but for storing configs, distributed locks, notifications etc. Again, it's convenient to use all this functionality with Curator Framework / Curator Recipes.

Zookeeper is using master/slave communication schema between nodes in cluster. Master is elected by cluster members. Be aware that there could be edge cases (due to network issues for example) when it appears more that 1 master in the cluster. In this case restart of the cluster helps.

Difference of Eureka from Zookeeper and Consul is that Eureka is narrow-purpose system - service discovery and load balancing system.

All 3 systems can be integrated with Spring.

like image 22
Alex M981 Avatar answered Oct 03 '22 05:10

Alex M981