8.3.1 Netflix Ribbon Support

Using the CLI

If you are creating your project using the Micronaut CLI, supply the netflix-ribbon feature to configure Netflix Ribbon in your project:

  1. $ mn create-app my-app features netflix-ribbon

Netflix Ribbon is a inter-process communication library used at Netflix that has support for customizable load balancing strategies.

If you need more flexibility in how your application performs client-side load balancing then you may wish use Micronaut’s Netflix Ribbon support.

To add Ribbon support to your application add the netflix-ribbon configuration to build.gradle or pom.xml:

build.gradle

  1. compile "io.micronaut.netflix:micronaut-netflix-ribbon"

The LoadBalancer implementations will now be RibbonLoadBalancer instances.

Ribbon’s Configuration options can be set using the ribbon namespace in configuration. For example in application.yml:

Configuring Ribbon

  1. ribbon:
  2. VipAddress: test
  3. ServerListRefreshInterval: 2000

Each discovered client can also be configured under ribbon.clients. For example given a @Client(id = "hello-world") you can configure Ribbon settings with:

Per Client Ribbon Settings

  1. ribbon:
  2. clients:
  3. hello-world:
  4. VipAddress: test
  5. ServerListRefreshInterval: 2000

By default Micronaut registers a DiscoveryClientServerList for each client that integrates Ribbon with Micronaut’s DiscoveryClient.