LoadbalanceStrategy that assigns a weight to each RSocket based on availability and usage statistics. The weight is used to decide which
RSocket to select.
WeightedStatsRequestInterceptor
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final double | |
| pack-priv final int | |
| pack-priv final Function |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static double | |
| public static WeightedLoadbalanceStrategy. | |
| private static double | |
| public static WeightedLoadbalanceStrategy | create()
Create an instance of |
| public void | initialize(RSocketConnector
the connector to configure connector)Implements io. InterceptorRegistry, to intercept
requests.
|
| public RSocket | select(List<RSocket>
the list to choose from sockets)Implements io. RSocket from the given non-empty list.
|
| EXP_FACTOR | back to summary |
|---|---|
| private static final double EXP_FACTOR | |
| maxPairSelectionAttempts | back to summary |
|---|---|
| pack-priv final int maxPairSelectionAttempts | |
| weightedStatsResolver | back to summary |
|---|---|
| pack-priv final Function<RSocket, WeightedStats> weightedStatsResolver | |
| WeightedLoadbalanceStrategy | back to summary |
|---|---|
| private WeightedLoadbalanceStrategy(int numberOfAttempts, Function<RSocket, WeightedStats> resolver) | |
| algorithmicWeight | back to summary |
|---|---|
| private static double algorithmicWeight(RSocket rSocket, final WeightedStats weightedStats) | |
| builder | back to summary |
|---|---|
| public static WeightedLoadbalanceStrategy. Return a builder to create a | |
| calculateFactor | back to summary |
|---|---|
| private static double calculateFactor(final double u, final double l, final double bandWidth) | |
| create | back to summary |
|---|---|
| public static WeightedLoadbalanceStrategy create() Create an instance of | |
| initialize | back to summary |
|---|---|
| public void initialize(RSocketConnector connector) Implements io. Doc from io. Initialize the connector, for example using the
| |
| select | back to summary |
|---|---|
| public RSocket select(List<RSocket> sockets) Implements io. Doc from io. Select an | |
WeightedLoadbalanceStrategy.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private Function |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public WeightedLoadbalanceStrategy | |
| public WeightedLoadbalanceStrategy. | maxPairSelectionAttempts(int
the iteration count numberOfAttempts)How many times to try to randomly select a pair of RSocket connections with non-zero availability. |
| public WeightedLoadbalanceStrategy. | weightedStatsResolver(Function<RSocket, WeightedStats>
to find the stats for an RSocket with resolver)Configure how the created |
| maxPairSelectionAttempts | back to summary |
|---|---|
| private int maxPairSelectionAttempts | |
| weightedStatsResolver | back to summary |
|---|---|
| private Function<RSocket, WeightedStats> weightedStatsResolver
| |
| Builder | back to summary |
|---|---|
| private Builder() | |
| build | back to summary |
|---|---|
| public WeightedLoadbalanceStrategy build() Build the | |
| maxPairSelectionAttempts | back to summary |
|---|---|
| public WeightedLoadbalanceStrategy. How many times to try to randomly select a pair of RSocket connections with non-zero availability. This is applicable when there are more than two connections in the pool. If the number of attempts is exceeded, the last selected pair is used. By default this is set to 5.
| |
| weightedStatsResolver | back to summary |
|---|---|
| public WeightedLoadbalanceStrategy. Configure how the created By default this resolver is not set. When
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public WeightedStats | apply(RSocket
the function argument rSocket)Implements java. |
| pack-priv void |
| statsMap | back to summary |
|---|---|
| pack-priv final Map<RSocket, WeightedStats> statsMap | |
| DefaultWeightedStatsResolver | back to summary |
|---|---|
| private DefaultWeightedStatsResolver() | |
| apply | back to summary |
|---|---|
| public WeightedStats apply(RSocket rSocket) Implements java. Doc from java. Applies this function to the given argument.
| |
| init | back to summary |
|---|---|
| pack-priv void init(RSocketConnector connector) | |