public class DynamicThrottlePolicy extends StaticThrottlePolicy
ThrottlePolicy
that offers dynamic limits to the number of pending messages a
SourceSession
is allowed to have.
NOTE: By context, "pending" is refering to the number of sent messages that have not been replied to yet.Constructor and Description |
---|
DynamicThrottlePolicy()
Constructs a new instance of this policy and sets the appropriate default values of member data.
|
DynamicThrottlePolicy(com.yahoo.concurrent.Timer timer)
Constructs a new instance of this class using the given clock to calculate efficiency.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSend(Message msg,
int pendingCount)
Returns whether or not the given message can be sent according to the current state of this policy.
|
int |
getMaxPendingCount()
Returns the maximum number of pending messages allowed.
|
double |
getMaxWindowSize()
Get the maximum number of pending operations allowed at any time.
|
double |
getMinWindowSize()
Get the minimum number of pending operations allowed at any time.
|
double |
getWindowSizeBackOff() |
double |
getWindowSizeIncrement() |
void |
processMessage(Message msg)
This method is called once for every message that was accepted by
ThrottlePolicy.canSend(Message, int) and sent. |
void |
processReply(Reply reply)
This method is called once for every reply that is received.
|
DynamicThrottlePolicy |
setEfficiencyThreshold(double efficiencyThreshold)
Sets the lower efficiency threshold at which the algorithm should perform window size back off.
|
DynamicThrottlePolicy |
setMaxPendingCount(int maxCount)
Sets the maximum number of pending messages allowed.
|
void |
setMaxThroughput(double maxThroughput) |
DynamicThrottlePolicy |
setMaxWindowSize(double max)
Sets the maximium number of pending operations allowed at any time, in
order to avoid using too much resources.
|
DynamicThrottlePolicy |
setMinWindowSize(double min)
Sets the minimium number of pending operations allowed at any time, in
order to keep a level of performance.
|
DynamicThrottlePolicy |
setResizeRate(double resizeRate)
Sets the rate at which the window size is updated.
|
DynamicThrottlePolicy |
setWeight(double weight)
Sets the weight for this client.
|
DynamicThrottlePolicy |
setWindowSizeBackOff(double windowSizeBackOff)
Sets the factor of window size to back off to when the algorithm determines that efficiency is not increasing.
|
DynamicThrottlePolicy |
setWindowSizeIncrement(double windowSizeIncrement)
Sets the step size used when increasing window size.
|
getMaxPendingSize, getPendingSize, setMaxPendingSize
public DynamicThrottlePolicy()
public DynamicThrottlePolicy(com.yahoo.concurrent.Timer timer)
timer
- The timer to use.public double getWindowSizeIncrement()
public double getWindowSizeBackOff()
public void setMaxThroughput(double maxThroughput)
public boolean canSend(Message msg, int pendingCount)
ThrottlePolicy
canSend
in interface ThrottlePolicy
canSend
in class StaticThrottlePolicy
msg
- The message to evaluate.pendingCount
- The current number of pending messages.public void processMessage(Message msg)
ThrottlePolicy
ThrottlePolicy.canSend(Message, int)
and sent.processMessage
in interface ThrottlePolicy
processMessage
in class StaticThrottlePolicy
msg
- The message beint sent.public void processReply(Reply reply)
ThrottlePolicy
processReply
in interface ThrottlePolicy
processReply
in class StaticThrottlePolicy
reply
- The reply received.public DynamicThrottlePolicy setEfficiencyThreshold(double efficiencyThreshold)
efficiencyThreshold
- The limit to set.setWindowSizeBackOff(double)
public DynamicThrottlePolicy setWindowSizeIncrement(double windowSizeIncrement)
windowSizeIncrement
- The step size to set.public DynamicThrottlePolicy setWindowSizeBackOff(double windowSizeBackOff)
windowSizeBackOff
- The back off to set.public DynamicThrottlePolicy setResizeRate(double resizeRate)
resizeRate
- The rate to set.public DynamicThrottlePolicy setWeight(double weight)
weight
- The weight to set.public DynamicThrottlePolicy setMaxWindowSize(double max)
max
- The max to set.public double getMaxWindowSize()
public DynamicThrottlePolicy setMinWindowSize(double min)
min
- The min to set.public double getMinWindowSize()
public DynamicThrottlePolicy setMaxPendingCount(int maxCount)
StaticThrottlePolicy
setMaxPendingCount
in class StaticThrottlePolicy
maxCount
- The max count.public int getMaxPendingCount()
getMaxPendingCount
in class StaticThrottlePolicy
Copyright © 2018. All rights reserved.