LATEST VERSION: 1.3 - CHANGELOG
Spring Cloud Services v1.3

Open-Source Usage

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.

Open-Source Foundation: Spring Cloud Netflix Eureka

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.

Netflix eureka d1

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.

Netflix eureka d2

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.

Netflix eureka d3

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 Eureka Server

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 application.yml (or application.properties).

eureka:
  instance:
    hostname: localhost
    nonSecurePort: 80

Spring Cloud Eureka Client

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 application.yml (or application.properties).

eureka:
  client:
    register-with-eureka: true
    leaseRenewalIntervalInSeconds: 10

Spring Cloud Services: Service Registry

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 count parameter given to the CLI command. The Spring Cloud Services service broker provisions count number 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 peers parameter 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.

Create a pull request or raise an issue on the source for this page in GitHub