8.3.1 Netflix Ribbon Support
Using the CLI If you create your project using the Micronaut CLI, supply the
|
Netflix Ribbon is an inter-process communication library used at Netflix with support for customizable load balancing strategies.
If you need more flexibility in how your application performs client-side load balancing, you can use Micronaut’s Netflix Ribbon support.
To add Ribbon support to your application, add the netflix-ribbon
configuration to your build:
implementation("io.micronaut.netflix:micronaut-netflix-ribbon")
<dependency>
<groupId>io.micronaut.netflix</groupId>
<artifactId>micronaut-netflix-ribbon</artifactId>
</dependency>
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
ribbon:
VipAddress: test
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
ribbon:
clients:
hello-world:
VipAddress: test
ServerListRefreshInterval: 2000
By default Micronaut registers a DiscoveryClientServerList for each client that integrates Ribbon with Micronaut’s DiscoveryClient.