Skip to content

Discovery Service Configuration

This section gives an overview of how to configure the Discovery Service and its sub components

Discovery Service

The Discovery Registry offers extensive configuration as available within the Spring Boot Eureka application. In addition there are user guides and functionality available here

Supported Status

When registering with the Discovery Service a number of status values are currently supported

Status Description
STARTING Component is initializing
UP Component is active
DOWN Component is no longer active
OUT_OF_SERVICE Component is active, but should not be queried
UNKNOWN This status is set when client is unable to determine given status

Discovery Registry (Eureka)

The Discovery Registry is driven via a startup script embedded within the application image. This allows the user to provide two environmental values to help drive the configuration of the Discovery Registry. These are

  • ${JAVA_OPTS} - This allows any valid java options to be provided to the JVM and underlying application. This can include JVM configuration such as memory allocations and Discovery Registry (spring boot) system properties.
  • ${CUSTOM_CONFIG} - By default there is a basic configuration yml provided within the application on the classpath. This is named application.yml. If none is provided the default application.yaml embedded in the image; a single node configuration will be used.

The embedded application.yaml is displayed below, this cover basic configuration available and should be noted that all values in this file all have defaults and can be overridden with system properties at runtime.

    hostname: localhost
    appname: kxinsights-eureka-cluster
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka
    register-with-eureka: true
    fetch-registry: true
      enable-self-preservation: false

  port: 8761

Available Discovery Registry configuration

The Discovery Registry offers a number of parameters which can be used to tune and configure the Discovery Service.

config default description
eureka.server.enableSelfPreservation true This describes the mechanism that stops evicting the instances when the heartbeats are below the expected threshold due to conditions such as a poor network partition, where the instances may still be up, but just can't be reached.
eureka.server.evictionIntervalTimerInMs 60000 The timer which checks for stale processes
eureka.server.renewalPercentThreshold 0.85 Based on this property, the server calculates the expected heartbeats per minute from all the registered clients – the default value is 0.85
eureka.server.responseCacheUpdateIntervalMs 30000 How often the server will update it's local cache of services
eureka.instance.hostname localhost Hostname of the running instance
eureka.instance.appname Name of the application name within a cluster. Used to group instances of an application
eureka.instance.preferIpAddress false In some cases, it's useful for Eureka to advertise IP address rather than hostnames
eureka.instance.leaseRenewalIntervalInSeconds 30 How often the instance will heartbeat
eureka.instance.leaseExpirationDurationInSeconds 90 How long before the instance should be evicted based on no heartbeats
eureka.client.registerWithEureka true Whether the Registry itself should register
eureka.client.fetchRegistry true Whether the Registry to keep a local cache
eureka.client.serviceUrl.defaultZone http://<host>:<port>/eureka Used for defining the distributed nodes within the Registry cluster
server.port 8761 Port the Discovery Registry will run on

These can be provided to the Discovery Registry when running the Discovery Service via two means.

Overriding with JAVA_OPTS

Configuration parameters within the Discover Registry can be overridden through JAVA_OPTS. For example the Discovery Registry application name and running port have been modified below

docker run -it --rm \
    --name=registry \
    -p 9000:9000 \
    -e JAVA_OPTS="-Deureka.instance.appname=CUSTOM_APP -Dserver.port=9000" \


When providing these via JAVA_OPTS it is necessary to follow JVM notation. For example eureka.instance.preferIpAddress would be -Deureka.instance.preferIpAddress=false

Custom application.yaml

Alternatively an entirely custom application.yaml can be provided at runtime when running the Discovery Registry. This requires mounting the directory containing the file into the docker container and setting the the environment variable CUSTOM_CONFIG.

docker run -it --rm \
    --name=registry \
    -p 8761:8761 \
    -v $(pwd):/data/config \
    -e "CUSTOM_CONFIG=/data/config/application.yaml" \

Discovery API Proxy

The Discovery API Proxy is mainly configured through the JSON configuration detailed here.

"discovery": {
  "adaptor": "discEurekaAdaptor.q",
  "registry": "kxi-eureka-registry:8761",
  "callTimeoutSecs": 30,
  "heartbeatSecs": 30,
  "leaseExpirySecs": 90

The adaptor field dictates what backend registry is being used. Currently only discEurekaAdaptor.q is supported for the Eureka registry. The remaining fields configure the Eureka adaptor.


Location of the Eureka registry service.


Registry call timeout (in seconds). Requests longer than this value will be timed out.


Frequency at which the client will heartbeat to the registry


Period after which the registry should timeout the client if no heartbeats received.