An implementation of TCP Illinois algorithm. More...
#include "tcp-illinois.h"
Public Member Functions | |
TcpIllinois () | |
Create an unbound tcp socket. | |
TcpIllinois (const TcpIllinois &sock) | |
Copy constructor. | |
~TcpIllinois () override | |
void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override |
Reset Illinois parameters to default values upon a loss. | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get slow start threshold after congestion event. | |
void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override |
Adjust cwnd following Illinois congestion avoidance algorithm. | |
void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override |
Measure RTT for each ACK Keep track of min and max RTT. | |
Public Member Functions inherited from ns3::TcpNewReno | |
TcpNewReno () | |
TcpNewReno (const TcpNewReno &sock) | |
Copy constructor. | |
~TcpNewReno () override | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get the slow start threshold after a loss event. | |
void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override |
Try to increase the cWnd following the NewReno specification. | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. | |
~TcpCongestionOps () override | |
virtual void | CongControl (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateConnection &rc, const TcpRateOps::TcpRateSample &rs) |
Called when packets are delivered to update cwnd and pacing rate. | |
virtual void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Trigger events/calculations on occurrence of congestion window event. | |
virtual bool | HasCongControl () const |
Returns true when Congestion Control Algorithm implements CongControl. | |
virtual void | Init (Ptr< TcpSocketState > tcb) |
Set configuration required by congestion control algorithm. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::TcpNewReno | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Member Functions | |
void | CalculateAlpha (double da, double dm) |
Calculate additive increase factor alpha. | |
Time | CalculateAvgDelay () const |
Calculate average queueing delay. | |
void | CalculateBeta (double da, double dm) |
Calculate multiplicative decrease factor beta. | |
Time | CalculateMaxDelay () const |
Calculate maximum queueing delay. | |
void | RecalcParam (uint32_t cWnd) |
Recalculate alpha and beta every RTT. | |
void | Reset (const SequenceNumber32 &nextTxSequence) |
Reset Illinois parameters. | |
Private Attributes | |
uint32_t | m_ackCnt |
Number of received ACK. | |
double | m_alpha |
Additive increase factor. | |
double | m_alphaBase |
Base value of alpha for standard AIMD. | |
double | m_alphaMax |
Maximum alpha threshold. | |
double | m_alphaMin |
Minimum alpha threshold. | |
Time | m_baseRtt |
Minimum of all RTT measurements. | |
double | m_beta |
Multiplicative decrease factor. | |
double | m_betaBase |
Base value of beta for standard AIMD. | |
double | m_betaMax |
Maximum beta threshold. | |
double | m_betaMin |
Minimum beta threshold. | |
uint32_t | m_cntRtt |
Number of RTT measurements during last RTT. | |
SequenceNumber32 | m_endSeq |
Right edge of current RTT. | |
Time | m_maxRtt |
Maximum of all RTT measurements. | |
bool | m_rttAbove |
True when da > d1. | |
uint8_t | m_rttLow |
Number of RTTs da has stayed below d1. | |
Time | m_sumRtt |
Sum of all RTT measurements during last RTT. | |
uint32_t | m_theta |
Number of RTTs required before setting alpha to its max. | |
uint32_t | m_winThresh |
Window threshold for adaptive sizing. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::TcpNewReno | |
virtual void | CongestionAvoidance (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
NewReno congestion avoidance. | |
virtual uint32_t | SlowStart (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Tcp NewReno slow start algorithm. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
An implementation of TCP Illinois algorithm.
TCP Illinois is a hybrid congestion control algorithm designed for high-speed networks. Illinois implements a Concave-AIMD (or C-AIMD) algorithm that uses packet loss as the primary congestion signal to determine the direction of window update and queueing delay as the secondary congestion signal to determine the amount of change.
The additive increase and multiplicative decrease factors (denoted as alpha and beta, respectively) are functions of the current average queueing delay da as shown in Equations (1) and (2). To improve the protocol robustness against sudden fluctuations in its delay sampling, Illinois allows the increment of alpha to alphaMax only if da stays below d1 for a some (theta) amount of time.
/ alphaMax if da <= d1 alpha = (1) \ k1 / (k2 + da) otherwise / betaMin if da <= d2 beta = k3 + k4da if d2 < da < d3 (2) \ betaMax otherwise
where the calculations of k1, k2, k3, and k4 are shown in Equations (3), (4), (5), and (6).
k1 = (dm - d1)(alphaMin)alphaMax / (alphaMax - alphaMin) (3) k2 = ((dm - d1)alphaMin / (alphaMax - alphaMin)) - d1 (4) k3 = ((alphaMin)d3 - (alphaMax)d2) / (d3 - d2) (5) k4 = (alphaMax - alphaMin) / (d3 - d2) (6)
with da the current average queueing delay calculated in Equation (7) where: Ta is the average RTT (sumRtt / cntRtt in the implementation) and Tmin (baseRtt in the implementation) is the minimum RTT ever seen dm the maximum (average) queueing delay calculated in Equation (8) where Tmax (maxRtt in the implementation) is the maximum RTT ever seen
da = Ta - Tmin (7) dm = Tmax - Tmin (8)
di (i = 1,2,3) are calculated in Equation (9) (0 <= eta_1 < 1, and 0 <= eta_2 <= eta_3 <=1)
di = (eta_i)dm (9)
Illinois only executes its adaptation of alpha and beta when cwnd exceeds a threshold called winThresh. Otherwise, it sets alpha and beta to the base values of 1 and 0.5, respectively.
Following the implementation of Illinois in the Linux kernel, we use the following default parameter settings:
alphaMin = 0.3 (0.1 in the Illinois paper) alphaMax = 10.0 betaMin = 0.125 betaMax = 0.5 winThresh = 15 (10 in the Illinois paper) theta = 5 eta1 = 0.01 eta2 = 0.1 eta3 = 0.8
More information: http://www.doi.org/10.1145/1190095.1190166
Definition at line 97 of file tcp-illinois.h.
ns3::TcpIllinois::TcpIllinois | ( | ) |
Create an unbound tcp socket.
Definition at line 78 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
ns3::TcpIllinois::TcpIllinois | ( | const TcpIllinois & | sock | ) |
Copy constructor.
sock | the object to copy |
Definition at line 102 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 126 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
Calculate additive increase factor alpha.
If average queueing delay is at minimum, then alpha is set to alphaMax. Otherwise, alpha is a decreasing function of average queueing delay.
da | current average queueing delay |
dm | maximum average queueing delay |
Definition at line 250 of file tcp-illinois.cc.
References m_alpha, m_alphaMax, m_alphaMin, m_rttAbove, m_rttLow, m_theta, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by RecalcParam().
|
private |
Calculate average queueing delay.
Definition at line 337 of file tcp-illinois.cc.
References m_baseRtt, m_cntRtt, m_sumRtt, and NS_LOG_FUNCTION.
Referenced by RecalcParam().
Calculate multiplicative decrease factor beta.
If the current average queueing delay is <= 10% of max. (average) queueing delay, beta is set to betaMin, which equals to 1/8 by default. If the current average queueing delay is >= 80% of max. (average) queueing delay, beta is set to betaMax, which equals to 1/2 by default. Otherwise, beta is an increasing function of average queueing delay.
da | current average queueing delay |
dm | maximum average queueing delay |
Definition at line 297 of file tcp-illinois.cc.
References m_beta, m_betaMax, m_betaMin, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by RecalcParam().
|
private |
Calculate maximum queueing delay.
Definition at line 345 of file tcp-illinois.cc.
References m_baseRtt, m_maxRtt, and NS_LOG_FUNCTION.
Referenced by RecalcParam().
|
overridevirtual |
Reset Illinois parameters to default values upon a loss.
tcb | internal congestion state |
newState | new congestion state to which the TCP is going to switch |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 156 of file tcp-illinois.cc.
References ns3::TcpSocketState::CA_LOSS, m_alpha, m_alphaBase, m_beta, m_betaBase, m_rttAbove, m_rttLow, NS_LOG_FUNCTION, and Reset().
|
overridevirtual |
Copy the congestion control algorithm across sockets.
Implements ns3::TcpCongestionOps.
Definition at line 363 of file tcp-illinois.cc.
References ns3::Object::CopyObject, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the name of the congestion control algorithm.
Implements ns3::TcpCongestionOps.
Definition at line 371 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Get slow start threshold after congestion event.
tcb | internal congestion state |
bytesInFlight | bytes in flight |
Implements ns3::TcpCongestionOps.
Definition at line 237 of file tcp-illinois.cc.
References m_beta, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 29 of file tcp-illinois.cc.
References m_alphaBase, m_alphaMax, m_alphaMin, m_betaBase, m_betaMax, m_betaMin, m_theta, m_winThresh, ns3::MakeDoubleAccessor(), ns3::MakeDoubleChecker(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), and ns3::TypeId::SetParent().
|
overridevirtual |
Adjust cwnd following Illinois congestion avoidance algorithm.
tcb | internal congestion state |
segmentsAcked | count of segments ACKed |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 172 of file tcp-illinois.cc.
References m_ackCnt, m_alpha, m_endSeq, NS_LOG_FUNCTION, NS_LOG_INFO, RecalcParam(), Reset(), and ns3::TcpNewReno::SlowStart().
|
overridevirtual |
Measure RTT for each ACK Keep track of min and max RTT.
tcb | internal congestion state |
segmentsAcked | count of segments ACKed |
rtt | last RTT |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 214 of file tcp-illinois.cc.
References ns3::Time::IsZero(), m_baseRtt, m_cntRtt, m_maxRtt, m_sumRtt, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
private |
Recalculate alpha and beta every RTT.
cWnd | current Cwnd (in bytes) |
Definition at line 132 of file tcp-illinois.cc.
References CalculateAlpha(), CalculateAvgDelay(), CalculateBeta(), CalculateMaxDelay(), ns3::Time::GetMilliSeconds(), m_alpha, m_alphaBase, m_beta, m_betaBase, m_cntRtt, m_winThresh, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by IncreaseWindow().
|
private |
Reset Illinois parameters.
nextTxSequence | Next sequence to transmit |
Definition at line 353 of file tcp-illinois.cc.
References m_cntRtt, m_endSeq, m_sumRtt, and NS_LOG_FUNCTION.
Referenced by CongestionStateSet(), and IncreaseWindow().
|
private |
Number of received ACK.
Definition at line 234 of file tcp-illinois.h.
Referenced by IncreaseWindow().
|
private |
Additive increase factor.
Definition at line 227 of file tcp-illinois.h.
Referenced by CalculateAlpha(), CongestionStateSet(), IncreaseWindow(), and RecalcParam().
|
private |
Base value of alpha for standard AIMD.
Definition at line 226 of file tcp-illinois.h.
Referenced by CongestionStateSet(), GetTypeId(), and RecalcParam().
|
private |
Maximum alpha threshold.
Definition at line 225 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Minimum alpha threshold.
Definition at line 224 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Minimum of all RTT measurements.
Definition at line 219 of file tcp-illinois.h.
Referenced by CalculateAvgDelay(), CalculateMaxDelay(), and PktsAcked().
|
private |
Multiplicative decrease factor.
Definition at line 231 of file tcp-illinois.h.
Referenced by CalculateBeta(), CongestionStateSet(), GetSsThresh(), and RecalcParam().
|
private |
Base value of beta for standard AIMD.
Definition at line 230 of file tcp-illinois.h.
Referenced by CongestionStateSet(), GetTypeId(), and RecalcParam().
|
private |
Maximum beta threshold.
Definition at line 229 of file tcp-illinois.h.
Referenced by CalculateBeta(), and GetTypeId().
|
private |
Minimum beta threshold.
Definition at line 228 of file tcp-illinois.h.
Referenced by CalculateBeta(), and GetTypeId().
|
private |
Number of RTT measurements during last RTT.
Definition at line 218 of file tcp-illinois.h.
Referenced by CalculateAvgDelay(), PktsAcked(), RecalcParam(), and Reset().
|
private |
Right edge of current RTT.
Definition at line 221 of file tcp-illinois.h.
Referenced by IncreaseWindow(), and Reset().
|
private |
Maximum of all RTT measurements.
Definition at line 220 of file tcp-illinois.h.
Referenced by CalculateMaxDelay(), and PktsAcked().
|
private |
True when da > d1.
Definition at line 222 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and CongestionStateSet().
|
private |
Number of RTTs da has stayed below d1.
Definition at line 223 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and CongestionStateSet().
|
private |
Sum of all RTT measurements during last RTT.
Definition at line 217 of file tcp-illinois.h.
Referenced by CalculateAvgDelay(), PktsAcked(), and Reset().
|
private |
Number of RTTs required before setting alpha to its max.
Definition at line 233 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Window threshold for adaptive sizing.
Definition at line 232 of file tcp-illinois.h.
Referenced by GetTypeId(), and RecalcParam().