java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.stack.MessageProtocol
org.jgroups.protocols.FLOW_CONTROL
- All Implemented Interfaces:
- org.jgroups.blocks.RequestHandler, java.lang.Runnable
- public class FLOW_CONTROL
- extends org.jgroups.stack.MessageProtocol
- implements java.lang.Runnable
FLOW_CONTROL provides end-end congestion control and flow control.
Attempts to maximize through put, by minimizing the
possible block times(Forward flow control). Initially, sender starts with a smaller
window size W and large expected RTT grpRTT. Sender also
keeps a margin in the window size. When the margin is hit, insted of waiting for the
window size to be exhausted, sender multicasts a FLOW_CONTROL info request message.
If the window size is exhausted before the responses are received, send will be blocked.
FCInfo(flow control info) from all the receivers is gathered at the sender, and current RTT
is computed. If the current RTT is greater than estimated RTT window size and margin are reduced,
otherwise they are increased.
Horizontal interaction is initiated by the sender with the other group members.
Note: A reliable transport layer is required for this protocol to function properly.
With little effort this can be made completely independent.
| Fields inherited from class org.jgroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn |
| Methods inherited from class org.jgroups.stack.Protocol |
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, startDownHandler, startUpHandler, statsEnabled, stopInternal, upThreadEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_numMSGsSentThisPeriod
private int _numMSGsSentThisPeriod
FLOW_CONTROL
private static final java.lang.String FLOW_CONTROL
- See Also:
- Constant Field Values
_rcvdMSGCounter
private final java.util.HashMap _rcvdMSGCounter
_windowSize
private int _windowSize
_fwdMarginSize
private int _fwdMarginSize
_estimatedRTT
private int _estimatedRTT
waitingForResponse
private boolean waitingForResponse
_reusableThread
private final org.jgroups.util.ReusableThread _reusableThread
RTT_WEIGHT
private double RTT_WEIGHT
_msgsSentAfterFCreq
private int _msgsSentAfterFCreq
TIME_OUT_FACTOR
private final double TIME_OUT_FACTOR
- See Also:
- Constant Field Values
TIME_OUT_INCR_MULT
private final double TIME_OUT_INCR_MULT
- See Also:
- Constant Field Values
WINDOW_SIZE_REDUCTION
private double WINDOW_SIZE_REDUCTION
WINDOW_SIZE_EXPANSION
private double WINDOW_SIZE_EXPANSION
isBlockState
private boolean isBlockState
_windowsize_cap
private int _windowsize_cap
FLOW_CONTROL
public FLOW_CONTROL()
getName
public java.lang.String getName()
handleDownEvent
public boolean handleDownEvent(org.jgroups.Event evt)
- If Event.MSG type is received count is incremented by one,
and message is passed to the down_prot. At some point,
based on the algorithm(FLOW_CONTROL protocol definition)
data collection sequence is started. This is done by each
member in SENDER role when _numMSGsSentThisPeriod hits the margin.
Before rsp arrives only _fwdMarginSize number of messages can be sent,
and then sender will be blocked.
handleUpEvent
public boolean handleUpEvent(org.jgroups.Event evt)
- If Event.MSG type is received message, number of received
messages from the sender is incremented. And the message is
passed up the stack.
handle
public java.lang.Object handle(org.jgroups.Message req)
- Called when a request for this protocol layer is received.
Processes and return value is sent back in the reply.
FLOW_CONTROL protocol of all members gets this message(including sender?)
- Specified by:
handle in interface org.jgroups.blocks.RequestHandler
run
public void run()
- FCInfo request must be submitted in a different thread.
handleDownEvent() can still be called to send messages
while waiting for FCInfo from receivers. usually takes
RTT.
- Specified by:
run in interface java.lang.Runnable
setProperties
public boolean setProperties(java.util.Properties props)
- Following parameters can be optionally supplied:
- window size cap -
int Limits the window size to a reasonable value.
- window size -
int these many number of messages are sent before a block could happen
- forward margin -
int a request for flow control information is sent when remaining window size hits this margin
- RTT weight -
double Max RTT in the group is calculated during each Flow control request. lower number assigns
higher weight to current RTT in estimating RTT.
- window size reduction factor -
double When current RTT is greater than estimated RTT current window size
is reduced by this multiple.
- window size expansion factor -
double When current RTT is less than estimated RTT window is incremented
by this multiple.
reqFCInfo
private org.jgroups.util.RspList reqFCInfo()