An implementation of TCP Illinois algorithm. More...
#include "tcp-illinois.h"
Public Member Functions | |
TcpIllinois () | |
Create an unbound tcp socket. More... | |
TcpIllinois (const TcpIllinois &sock) | |
Copy constructor. More... | |
~TcpIllinois () override | |
void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override |
Reset Illinois parameters to default values upon a loss. More... | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. More... | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. More... | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get slow start threshold after congestion event. More... | |
void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override |
Adjust cwnd following Illinois congestion avoidance algorithm. More... | |
void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override |
Measure RTT for each ACK Keep track of min and max RTT. More... | |
Public Member Functions inherited from ns3::TcpNewReno | |
TcpNewReno () | |
TcpNewReno (const TcpNewReno &sock) | |
Copy constructor. More... | |
~TcpNewReno () override | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. More... | |
~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. More... | |
virtual void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Trigger events/calculations on occurrence of congestion window event. More... | |
virtual bool | HasCongControl () const |
Returns true when Congestion Control Algorithm implements CongControl. More... | |
virtual void | Init (Ptr< TcpSocketState > tcb[[maybe_unused]]) |
Set configuration required by congestion control algorithm. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::TcpNewReno | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Private Member Functions | |
void | CalculateAlpha (double da, double dm) |
Calculate additive increase factor alpha. More... | |
Time | CalculateAvgDelay () const |
Calculate average queueing delay. More... | |
void | CalculateBeta (double da, double dm) |
Calculate multiplicative decrease factor beta. More... | |
Time | CalculateMaxDelay () const |
Calculate maximum queueing delay. More... | |
void | RecalcParam (uint32_t cWnd) |
Recalculate alpha and beta every RTT. More... | |
void | Reset (const SequenceNumber32 &nextTxSequence) |
Reset Illinois parameters. More... | |
Private Attributes | |
uint32_t | m_ackCnt |
Number of received ACK. More... | |
double | m_alpha |
Additive increase factor. More... | |
double | m_alphaBase |
Base value of alpha for standard AIMD. More... | |
double | m_alphaMax |
Maximum alpha threshold. More... | |
double | m_alphaMin |
Minimum alpha threshold. More... | |
Time | m_baseRtt |
Minimum of all RTT measurements. More... | |
double | m_beta |
Multiplicative decrease factor. More... | |
double | m_betaBase |
Base value of beta for standard AIMD. More... | |
double | m_betaMax |
Maximum beta threshold. More... | |
double | m_betaMin |
Minimum beta threshold. More... | |
uint32_t | m_cntRtt |
Number of RTT measurements during last RTT. More... | |
SequenceNumber32 | m_endSeq |
Right edge of current RTT. More... | |
Time | m_maxRtt |
Maximum of all RTT measurements. More... | |
bool | m_rttAbove |
True when da > d1. More... | |
uint8_t | m_rttLow |
Number of RTTs da has stayed below d1. More... | |
Time | m_sumRtt |
Sum of all RTT measurements during last RTT. More... | |
uint32_t | m_theta |
Number of RTTs required before setting alpha to its max. More... | |
uint32_t | m_winThresh |
Window threshold for adaptive sizing. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::TcpNewReno | |
virtual void | CongestionAvoidance (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
NewReno congestion avoidance. More... | |
virtual uint32_t | SlowStart (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Tcp NewReno slow start algorithm. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose () |
Destructor implementation. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
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 108 of file tcp-illinois.h.
ns3::TcpIllinois::TcpIllinois | ( | ) |
Create an unbound tcp socket.
Definition at line 89 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 113 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 137 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
|
private |
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 261 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 348 of file tcp-illinois.cc.
References m_baseRtt, m_cntRtt, m_sumRtt, and NS_LOG_FUNCTION.
Referenced by RecalcParam().
|
private |
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 308 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 356 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 167 of file tcp-illinois.cc.
References ns3::TcpSocketState::CA_LOSS, m_alpha, m_alphaBase, m_beta, m_betaBase, ns3::TcpSocketState::m_nextTxSequence, m_rttAbove, m_rttLow, NS_LOG_FUNCTION, and Reset().
|
overridevirtual |
Copy the congestion control algorithm across sockets.
Reimplemented from ns3::TcpNewReno.
Definition at line 374 of file tcp-illinois.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Get the name of the congestion control algorithm.
Reimplemented from ns3::TcpNewReno.
Definition at line 382 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 |
Reimplemented from ns3::TcpNewReno.
Definition at line 248 of file tcp-illinois.cc.
References m_beta, max, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 40 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::MakeUintegerAccessor(), and ns3::TypeId::SetParent().
|
overridevirtual |
Adjust cwnd following Illinois congestion avoidance algorithm.
tcb | internal congestion state |
segmentsAcked | count of segments ACKed |
Reimplemented from ns3::TcpNewReno.
Definition at line 183 of file tcp-illinois.cc.
References ns3::TcpSocketState::GetCwndInSegments(), m_ackCnt, m_alpha, ns3::TcpSocketState::m_cWnd, m_endSeq, ns3::TcpSocketState::m_lastAckedSeq, ns3::TcpSocketState::m_nextTxSequence, ns3::TcpSocketState::m_segmentSize, ns3::TcpSocketState::m_ssThresh, 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 225 of file tcp-illinois.cc.
References ns3::Time::IsZero(), m_baseRtt, m_cntRtt, m_maxRtt, m_sumRtt, max, min, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
private |
Recalculate alpha and beta every RTT.
cWnd | current Cwnd (in bytes) |
Definition at line 143 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 364 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 245 of file tcp-illinois.h.
Referenced by IncreaseWindow().
|
private |
Additive increase factor.
Definition at line 238 of file tcp-illinois.h.
Referenced by CalculateAlpha(), CongestionStateSet(), IncreaseWindow(), and RecalcParam().
|
private |
Base value of alpha for standard AIMD.
Definition at line 237 of file tcp-illinois.h.
Referenced by CongestionStateSet(), GetTypeId(), and RecalcParam().
|
private |
Maximum alpha threshold.
Definition at line 236 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Minimum alpha threshold.
Definition at line 235 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Minimum of all RTT measurements.
Definition at line 230 of file tcp-illinois.h.
Referenced by CalculateAvgDelay(), CalculateMaxDelay(), and PktsAcked().
|
private |
Multiplicative decrease factor.
Definition at line 242 of file tcp-illinois.h.
Referenced by CalculateBeta(), CongestionStateSet(), GetSsThresh(), and RecalcParam().
|
private |
Base value of beta for standard AIMD.
Definition at line 241 of file tcp-illinois.h.
Referenced by CongestionStateSet(), GetTypeId(), and RecalcParam().
|
private |
Maximum beta threshold.
Definition at line 240 of file tcp-illinois.h.
Referenced by CalculateBeta(), and GetTypeId().
|
private |
Minimum beta threshold.
Definition at line 239 of file tcp-illinois.h.
Referenced by CalculateBeta(), and GetTypeId().
|
private |
Number of RTT measurements during last RTT.
Definition at line 229 of file tcp-illinois.h.
Referenced by CalculateAvgDelay(), PktsAcked(), RecalcParam(), and Reset().
|
private |
Right edge of current RTT.
Definition at line 232 of file tcp-illinois.h.
Referenced by IncreaseWindow(), and Reset().
|
private |
Maximum of all RTT measurements.
Definition at line 231 of file tcp-illinois.h.
Referenced by CalculateMaxDelay(), and PktsAcked().
|
private |
True when da > d1.
Definition at line 233 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and CongestionStateSet().
|
private |
Number of RTTs da has stayed below d1.
Definition at line 234 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and CongestionStateSet().
|
private |
Sum of all RTT measurements during last RTT.
Definition at line 228 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 244 of file tcp-illinois.h.
Referenced by CalculateAlpha(), and GetTypeId().
|
private |
Window threshold for adaptive sizing.
Definition at line 243 of file tcp-illinois.h.
Referenced by GetTypeId(), and RecalcParam().