Service discovery

There are several use-cases where the 3DS Server Admin application needs to connect to the active 3DS Server instances. One scenario is to notify the 3DS Server instances that the configuration needs to be reloaded. From the configuration tab, the 3DS Server Admin application can update a domain configuration table. After the configuration is validated it can be applied to the 3DS Server instances.

Other scenario is to fetch statistical data from each individual instance.

Service Discovery is the process of one service dynamically discovering the network location of another service to communicate with it. Using Service Discovery is beneficial because it allows more dynamic way of adding or removing instances, without the need of the Admin to be restarted. The Service Registry is a key part of Service Discovery. It is a database containing the network locations of service instances.

A Service Registry needs to be highly available and up to date. Clients can cache network locations obtained from the Service Registry. This makes the application highly scalable.

There are two Discovery Client implementations provided in the 3DS Server: Netflix Eureka and AWS ECS Discovery Client.

Netflix Eureka

Eureka is a REST (Representational State Transfer) based service that is primarily used for locating services for the purpose of load balancing and failover of middle-tier servers. Netflix Eureka is built for high availability.

Netflix Eureka architecture consists of two components, the Server and the Client.

The Server is a standalone application. It is responsible for:

  • managing a registry of Service Instances,
  • providing ways to register, de-register and query Instances with the registry,
  • registry propagation to other Eureka Instances (Servers or Clients).

The Client is part of the Service Instance ecosystem. It is responsible for:

  • registering and unregistering a Service Instance with Eureka Server,
  • keeping the connection with Eureka Server alive,
  • retrieving and caching discovery information from the Eureka Server.

The 3DS Server Admin application comes with a packaged Eureka Server (Discovery Server) and can be started as part of the application. Another option is to use a standalone Eureka Server and configure the 3DS Server Admin and 3DS Server to use that. Each 3DS Server instance registers itself in the Eureka Server upon start up, providing metadata about itself, such as host, port and other details.

The 3DS Server instance send heartbeat messages. Eureka Server expects these heartbeat messages in order to keep the instance in the Registry from expiring, otherwise the instance is removed from the Registry.

The 3DSS Admin retrieves a list of all connected 3DS Server instances from the Service Registry (Eureka Server) and can make remote calls to them, e.g. 'Reload configuration'.

Configuring Eureka Client on the 3DS Server and Service Registry on the 3DS Server Admin application can be done in the application.properties file for each application. You can find more information in the Configuration Properties page and the Admin Configuration Properties for the applications.

AWS ECS Discovery Client

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications. It deeply integrates with the rest of the AWS platform to provide a secure and easy-to-use solution for running container workloads in the cloud.

The ECS Discovery Client is a custom discovery client based on the Spring Cloud implementation of Discovery Client, that is used to discover all of the 3DS Server instances running in a single AWS Cluster so then they can be used when needed.

The ECS Discovery Client can be activated in the Admin application. You can check the relevant properties for the ECS Discovery Client in the Admin application properties Admin Configuration Properties. When the ECS Discovery Client is enabled it will search for the 3DS Server instances (AWS tasks) in the specified cluster with a 3DS Server container name also defined in the properties.

The mapping of the ECS tasks to a Spring Cloud Instance is done in the following way:

Spring Cloud ECS
Instance ID Task Container Arn
Service ID Task Container Name
Instance Host Task attachment Private DNS Name
Instance Port Task Definition Container Port
Instance Is Secure False
Instance URI $Instance Scheme://$Instance Host:$Instance Port
Instance Metadata Product tag of Task
Instance Scheme http

Validate and reload configuration

On 'Validate and reload configuration', the 3DSS Admin app firstly validates the new / updated configuration and then makes remote calls to each registered 3DS Server instance, to reload the configuration. The 3DSS Admin retrieves a list of all connected 3DS Server instances. If none is registered a warning message is displayed.