public interface ILoadController
The second strategy only works if you have some acknowledgement callback, telling you about the traversal time of the data. It can then be used to avoid overloading your processing path. A typical example of using this is inside a Storm topology.
It works as follows: whenever you want to accept a new incoming message in the system, you call the regulate() method. It will automatically slow down your processing rate. When a processed message is acknowledged,fully processed by the application, call the update method with the corresponding processing time in millisecond.
| Modifier and Type | Method and Description |
|---|---|
void |
ack(long traversalTime)
update the controller statistics.
|
void |
fail(long traversalTime)
update the controller statistics.
|
int |
getCurrentRate() |
void |
regulate()
regulate the traffic, this method potentially take some time before returning.
|
ILoadController |
setMaxTimeoutSec(int maxTraversalTime)
Set the time considered as the maximum traversal time.
|
void ack(long traversalTime)
traversalTime - the traversal time of a tuple, in millisecondsvoid fail(long traversalTime)
traversalTime - the traversal time of a tuple, in millisecondsvoid regulate()
ILoadController setMaxTimeoutSec(int maxTraversalTime)
maxTraversalTime - the maximum traversal timeint getCurrentRate()
Copyright © 2023. All rights reserved.