Class WeightRampingUpStrategyBuilder
java.lang.Object
com.linecorp.armeria.client.endpoint.WeightRampingUpStrategyBuilder
@UnstableApi public final class WeightRampingUpStrategyBuilder extends Object
Builds a weight ramping up
EndpointSelectionStrategy
which ramps the weight of newly added
Endpoint
s. The Endpoint
is selected using weighted random distribution.-
Constructor Summary
Constructors Constructor Description WeightRampingUpStrategyBuilder()
-
Method Summary
Modifier and Type Method Description EndpointSelectionStrategy
build()
Returns a newly-created weight ramping upEndpointSelectionStrategy
which ramps the weight of newly addedEndpoint
s.WeightRampingUpStrategyBuilder
executor(EventExecutor executor)
Sets theEventExecutor
to use to execute tasks for computing new weights.WeightRampingUpStrategyBuilder
rampingUpInterval(Duration rampingUpInterval)
Sets the interval between weight updates during ramp up.WeightRampingUpStrategyBuilder
rampingUpIntervalMillis(long rampingUpIntervalMillis)
Sets the interval between weight updates during ramp up.WeightRampingUpStrategyBuilder
rampingUpTaskWindow(Duration rampingUpTaskWindow)
Sets the window for combining weight update tasks.WeightRampingUpStrategyBuilder
rampingUpTaskWindowMillis(long rampingUpTaskWindowMillis)
Sets the window for combining weight update tasks.WeightRampingUpStrategyBuilder
totalSteps(int totalSteps)
Sets the total number of steps to compute weights for a givenEndpoint
while ramping up.WeightRampingUpStrategyBuilder
transition(EndpointWeightTransition transition)
Sets theEndpointWeightTransition
which will be used to compute the weight at each step while ramping up.
-
Constructor Details
-
WeightRampingUpStrategyBuilder
public WeightRampingUpStrategyBuilder()
-
-
Method Details
-
transition
Sets theEndpointWeightTransition
which will be used to compute the weight at each step while ramping up.EndpointWeightTransition.linear()
is used by default. -
executor
Sets theEventExecutor
to use to execute tasks for computing new weights. AnEventLoop
fromCommonPools.workerGroup()
is used by default. -
rampingUpInterval
Sets the interval between weight updates during ramp up. 2000L millis is used by default. -
rampingUpIntervalMillis
Sets the interval between weight updates during ramp up. 2000L millis is used by default. -
totalSteps
Sets the total number of steps to compute weights for a givenEndpoint
while ramping up. 10 is used by default. -
rampingUpTaskWindow
Sets the window for combining weight update tasks. If more than oneEndpoint
are added within therampingUpTaskWindow
, the weights of them are ramped up together. If there's already a scheduled job and newEndpoint
s are added within therampingUpTaskWindow
, they are also ramped up together. This is an example of how it works whenrampingUpTaskWindow
is 500 milliseconds andrampingUpIntervalMillis
is 2000 milliseconds:
A and B are ramped up right away when they are added and they are ramped up together at t4. C is ramped up alone every 2000 milliseconds. D is ramped up together with A and B at t4.---------------------------------------------------------------------------------------------------- A B C D t0 t1 t2 t3 t4 ---------------------------------------------------------------------------------------------------- 0ms t0 + 200ms t0 + 1000ms t0 + 1800ms t0 + 2000ms
-
rampingUpTaskWindowMillis
Sets the window for combining weight update tasks. If more than oneEndpoint
are added within therampingUpTaskWindowMillis
, the weights of them are ramped up together. If there's already a scheduled job and newEndpoint
s are added within therampingUpTaskWindow
, they are also ramped up together. This is an example of how it works whenrampingUpTaskWindowMillis
is 500 milliseconds andrampingUpIntervalMillis
is 2000 milliseconds:
A and B are ramped up right away when they are added and they are ramped up together at t4. C is ramped up alone every 2000 milliseconds. D is ramped up together with A and B at t4.---------------------------------------------------------------------------------------------------- A B C D t0 t1 t2 t3 t4 ---------------------------------------------------------------------------------------------------- 0ms t0 + 200ms t0 + 1000ms t0 + 1800ms t0 + 2000ms
-
build
Returns a newly-created weight ramping upEndpointSelectionStrategy
which ramps the weight of newly addedEndpoint
s. TheEndpoint
is selected using weighted random distribution.
-