What is the role of Zookeeper vs Eureka for microservices?

29,248

Solution 1

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.

Solution 2

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.

Share:
29,248
Supun Wijerathne
Author by

Supun Wijerathne

Top 5% in Java Intellij-Idea Design-Patterns Top 10% in Multithreading Play-Framework Json Map-Reduce Hadoop Top 20% in Concurrency Interested in Spring Java8 Java-Streams Architecture Microservices REST Akka Bigdata Nosql Distributed Git Find me on LinkedIn, Blog, Facebook. Email: [email protected].

Updated on July 09, 2022

Comments

  • Supun Wijerathne
    Supun Wijerathne almost 2 years

    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?

  • Supun Wijerathne
    Supun Wijerathne over 6 years
    thank you for the response. Could you please specify your understanding on those 3 tools, more over showing links. It would be so helpful. :))
  • Supun Wijerathne
    Supun Wijerathne over 6 years
    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?
  • Alex M981
    Alex M981 over 6 years
    elaborated my understanding of these systems
  • 123
    123 about 5 years
    Eureka isn't a load balancer at all, it's service discovery. Ribbon does load balancing.
  • Oswin Noetzelmann
    Oswin Noetzelmann about 5 years
    @123: I enhanced the sentence to make sure it does reflect Eureka is only used as a part of Netflix' load balancing.
  • theprogrammer
    theprogrammer over 2 years
    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?