Random Load Balancing#
The random
load balancing is a straightforward service instance selection solution that picks a random instance every time.
Dependency#
First, you need to add the random load-balancer to your project:
<dependency>
<groupId>io.smallrye.stork</groupId>
<artifactId>stork-load-balancer-random</artifactId>
<version>2.7.1</version>
</dependency>
Configuration#
For each service expected to use a random service selection, configure the load-balancer
to be random
:
Supported attributes are the following:
Attribute | Mandatory | Default Value | Description |
---|---|---|---|
use-secure-random |
No | false |
Whether the load balancer should use a SecureRandom instead of a Random (default). Check this page to understand the difference |