Page last updated:
The Spring Cloud Services Service Registry is based on the Spring Cloud Netflix Eureka project. See below for information about the open-source Spring Cloud project.
The Spring Cloud Netflix Eureka project, like the rest of Spring Cloud, builds on Spring Boot. It provides a wrapper around Eureka, Netflix’s open-sourced service registry.
The servers in a Eureka cluster replicate a registry of application instances. Registered applications use the Eureka client to fetch connection and status information about other registered applications, and use this information to connect to instances of other applications.
A client application (here “Producer”) instance registers with a Eureka server and provides metadata, including host, port, and instance ID. The Producer instance then sends a “heartbeat” message to the Eureka server every 30 seconds. If an application instance fails to send several consecutive heartbeats, the Eureka server removes that instance from its registry.
Each client application (here Consumer) instance also uses the Eureka client to fetch the registry from the Eureka server once every 30 seconds (by default). The Consumer instance caches the registry and uses this cache to locate instances of other applications. The Eureka client uses a round-robin load balancing strategy to select a specific instance for each request.
Spring Cloud Netflix Eureka provides an embeddable Eureka server, which can be enabled in a Spring Boot application using the
@EnableEurekaServer annotation. When the Spring Cloud Eureka Server starter (
spring-cloud-starter-eureka-server) dependency is included, the application becomes a Spring Cloud Netflix Eureka server.
In a Spring Cloud Netflix Eureka server application, a Eureka server configuration can be set using the
eureka.instance properties in
eureka: instance: hostname: localhost nonSecurePort: 80
The Spring Cloud Commons module includes the
DiscoveryClient abstraction and
@EnableDiscoveryClient annotation for applications to use in discovering services, and Spring Cloud Netflix Eureka provides a
DiscoveryClient implementation for Eureka. When the Spring Cloud Eureka starter (
spring-cloud-starter-eureka) dependency is included, the application becomes a client of a Spring Cloud Netflix Eureka server.
In a Spring Cloud Netflix Eureka client application, Eureka client configuration can be set using the
eureka.client properties in
eureka: client: register-with-eureka: true leaseRenewalIntervalInSeconds: 10
Spring Cloud Services packages the Spring Cloud Netflix Eureka server application, provisioning one or more instances per Service Registry service instance: one by default, more if the service instance has been created to run in High Availability (HA) mode. This provides operational benefits atop the open-source Spring Cloud library:
Application-level registry High Availability (HA). When creating or updating a Spring Cloud Services Service Registry using the Cloud Foundry Command Line Interface tool (cf CLI), operators can specify a
countparameter given to the CLI command. The Spring Cloud Services service broker provisions
countnumber of Spring Cloud Netflix Eureka server applications for the service instance. These server applications replicate one registry.
Zero-downtime blue / green application deployments and upgrades. The Spring Cloud Services Service Registry permits multiple client applications to register using the same Eureka application name (see [docs page]). Operators can take advantage of this and of Netflix Eureka’s instance statuses to deploy updates to applications with zero downtime, using (for example) a blue / green deployment strategy.
Peer replication across PCFs / datacenters. When creating or updating a Spring Cloud Services Service Registry using the cf CLI, operators can specify URIs of other Service Registry service instances in a
peersparameter given to the CLI command, and the Service Registry service instance replicates its registry with the other service instances. This works for service instances across Pivotal Cloud Foundry spaces, orgs, or deployments, and can be used to provide another level of high availability.