Hello everyone, let’s take an overview of this blog. In this blog, I will discuss how we can compare spring cloud gateway with eureka vs consul. Microservices is a newer architectural pattern for enterprise web service development. However, one of the greatest challenges with this sort of design is how to oversee the revelation of the web services. Moreover, based on this challenge, there are a few distinctive open-source alternatives.
What is Eureka?
- Eureka Server is an application that holds the information about all client-service applications.
- Every Micro service will register into the Eureka server. Similarly, eureka server knows all the client applications running on each port and IP address.
- We can deploy or self launched Eureka Server as a Runnable JAR. On the other hand Eureka Client is attach through Spring Boot and is part of the application.
What is Consul.io?
- The Consul is an application that is launch from the command line.
- We can use control-c as a result it terminate the Server instance gracefully.
- Despite that a datacenter is attach internally with a join command specifying the Consul Server nodes.
- However, to connect the Datacenters, one of the Consul Server instance need to join -wan with the other WAN servers.
- Consequently, the Datacenter to Datacenter communication is limited to Consul Server communication between Centers.
Sample Consul.io configuartion:
Sample Eureka configuration:
Comparison between Eureka and Consul.io:
Spring Cloud integration
|Yes – Angel SR3||Yes – Brixton|
Management in Container
|I believe so. There are docker targets. However, based on documentation, I am not clear on the configuration of peers.||Yes. The API implies Docker support.|
Health monitoring of Endpoints
|Yes. Removal of failed after 90 minutes (configurable)||Yes. Removal after 72 hours. (Fixed)|
|Possible||Yes per application documentation.|
|No. Would require another package.||Yes. Built-in.|
|Possible but not used in Netflix||Yes. Keygen and other configuration is done via Consul CLI|
Endpoint Update method
|Delta content with occasional full content||Always full content|
Recommended Number per datacenter
|2 or more instances of Server connected as Peers||3-5 instances per Datacenter with the ability to connect Datacenters.|
|Supported with Hystrix and code modification||Not available|
Health Check data collection
|Hystrix with HystrixDashboard. Aggregation via Turbine.||Built into the Consul.io web access page.|
|Requires addition of Sidecar.||Built-in support.|
To sum up, looking at Micro-service architectures, one of the biggest challenges is managing Service Discovery and providing a reliable architecture. Similarly, along those lines, two different Service Discovery options are easily integrated into an application using Spring Cloud: Eureka and Consul.io. Meanwhile, eureka comes from the Netflix OSS and was added to one of the Spring Cloud release pipelines. Consul.io comes from HashiCorp and is maintained by both HashiCorp and the open-source community. Consul.io was also added to a Spring Cloud release pipeline. Hence, there are other Service Discovery utilities. However, these are the only ones evaluated for this purpose.
For more, you can refer to the documentation: https://cloud.spring.io/spring-cloud-gateway/reference/html/