What is the role of Zookeeper vs Eureka for microservices?
Asked Answered
H

2

49

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?

Heyes answered 6/2, 2018 at 5:0 Comment(0)
C
46

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:

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.
Cumber answered 6/2, 2018 at 21:59 Comment(4)
Thank You for the answer. Anyhow, I was not telling I am going to solve it myself without any tool. Anyway can you pls give me the relationship between kubernetes and zookeeper/eureka?Heyes
Eureka isn't a load balancer at all, it's service discovery. Ribbon does load balancing.Auscultate
@123: I enhanced the sentence to make sure it does reflect Eureka is only used as a part of Netflix' load balancing.Cumber
how does zookeeper work both as "coordination service" and "service discovery" while eureka is only "service discovery"? Any blog or link that talks about this?Vaughan
C
26

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.

Chao answered 6/2, 2018 at 6:54 Comment(2)
thank you for the response. Could you please specify your understanding on those 3 tools, more over showing links. It would be so helpful. :))Heyes
elaborated my understanding of these systemsChao

© 2022 - 2024 — McMap. All rights reserved.