An implementation of TCP Vegas. More...
#include "tcp-vegas.h"
Public Member Functions | |
TcpVegas (void) | |
Create an unbound tcp socket. More... | |
TcpVegas (const TcpVegas &sock) | |
Copy constructor. More... | |
virtual | ~TcpVegas (void) |
virtual void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) |
Enable/disable Vegas algorithm depending on the congestion state. More... | |
virtual Ptr< TcpCongestionOps > | Fork () |
Copy the congestion control algorithm across socket. More... | |
virtual std::string | GetName () const |
Get the name of the congestion control algorithm. More... | |
virtual uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) |
Get slow start threshold following Vegas principle. More... | |
virtual void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Adjust cwnd following Vegas linear increase/decrease algorithm. More... | |
virtual void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) |
Compute RTTs needed to execute Vegas algorithm. More... | |
Public Member Functions inherited from ns3::TcpNewReno | |
TcpNewReno () | |
TcpNewReno (const TcpNewReno &sock) | |
Copy constructor. More... | |
~TcpNewReno () | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. More... | |
virtual | ~TcpCongestionOps () |
virtual void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Trigger events/calculations on occurrence congestion window event. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) 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) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) 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 erros. 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 (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::TcpNewReno | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
void | DisableVegas () |
Stop taking Vegas samples. More... | |
void | EnableVegas (Ptr< TcpSocketState > tcb) |
Enable Vegas algorithm to start taking Vegas samples. More... | |
Private Attributes | |
uint32_t | m_alpha |
Alpha threshold, lower bound of packets in network. More... | |
Time | m_baseRtt |
Minimum of all Vegas RTT measurements seen during connection. More... | |
SequenceNumber32 | m_begSndNxt |
Right edge during last RTT. More... | |
uint32_t | m_beta |
Beta threshold, upper bound of packets in network. More... | |
uint32_t | m_cntRtt |
Number of RTT measurements during last RTT. More... | |
bool | m_doingVegasNow |
If true, do Vegas for this RTT. More... | |
uint32_t | m_gamma |
Gamma threshold, limit on increase. More... | |
Time | m_minRtt |
Minimum of all RTT measurements within last RTT. 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 (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
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 (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
An implementation of TCP Vegas.
Introspection did not find any typical Config paths.
TCP Vegas is a pure delay-based congestion control algorithm implementing a proactive scheme that tries to prevent packet drops by maintaining a small backlog at the bottleneck queue.
Vegas continuously measures the actual throughput a connection achieves as shown in Equation (1) and compares it with the expected throughput calculated in Equation (2). The difference between these 2 sending rates in Equation (3) reflects the amount of extra packets being queued at the bottleneck.
actual = cwnd / RTT (1) expected = cwnd / BaseRTT (2) diff = expected - actual (3)
To avoid congestion, Vegas linearly increases/decreases its congestion window to ensure the diff value fall between the 2 predefined thresholds, alpha and beta. diff and another threshold, gamma, are used to determine when Vegas should change from its slow-start mode to linear increase/decrease mode.
Following the implementation of Vegas in Linux, we use 2, 4, and 1 as the default values of alpha, beta, and gamma, respectively.
More information: http://dx.doi.org/10.1109/49.464716
No TraceSources are defined for this type.
Size of this type is 72 bytes (on a 64-bit architecture).
Definition at line 64 of file tcp-vegas.h.
ns3::TcpVegas::TcpVegas | ( | void | ) |
Create an unbound tcp socket.
Definition at line 58 of file tcp-vegas.cc.
References NS_LOG_FUNCTION.
ns3::TcpVegas::TcpVegas | ( | const TcpVegas & | sock | ) |
Copy constructor.
sock | the object to copy |
Definition at line 72 of file tcp-vegas.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 86 of file tcp-vegas.cc.
References NS_LOG_FUNCTION.
|
virtual |
Enable/disable Vegas algorithm depending on the congestion state.
We only start a Vegas cycle when we are in normal congestion state (CA_OPEN state).
tcb | internal congestion state |
newState | new congestion state to which the TCP is going to switch |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 139 of file tcp-vegas.cc.
References ns3::TcpSocketState::CA_OPEN, DisableVegas(), EnableVegas(), and NS_LOG_FUNCTION.
Referenced by TcpVegasTest::DoRun().
|
private |
Stop taking Vegas samples.
Definition at line 131 of file tcp-vegas.cc.
References m_doingVegasNow, and NS_LOG_FUNCTION.
Referenced by CongestionStateSet().
|
private |
Enable Vegas algorithm to start taking Vegas samples.
Vegas algorithm is enabled in the following situations:
tcb | internal congestion state |
Definition at line 120 of file tcp-vegas.cc.
References m_begSndNxt, m_cntRtt, m_doingVegasNow, m_minRtt, ns3::TcpSocketState::m_nextTxSequence, ns3::Time::Max(), and NS_LOG_FUNCTION.
Referenced by CongestionStateSet().
|
virtual |
Copy the congestion control algorithm across socket.
Reimplemented from ns3::TcpNewReno.
Definition at line 92 of file tcp-vegas.cc.
|
virtual |
Get the name of the congestion control algorithm.
Reimplemented from ns3::TcpNewReno.
Definition at line 281 of file tcp-vegas.cc.
|
virtual |
Get slow start threshold following Vegas principle.
tcb | internal congestion state |
bytesInFlight | bytes in flight |
Reimplemented from ns3::TcpNewReno.
Definition at line 287 of file tcp-vegas.cc.
References max, min, and NS_LOG_FUNCTION.
Referenced by IncreaseWindow().
|
static |
Get the type ID.
Definition at line 36 of file tcp-vegas.cc.
References m_alpha, m_beta, m_gamma, ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().
|
virtual |
Adjust cwnd following Vegas linear increase/decrease algorithm.
tcb | internal congestion state |
segmentsAcked | count of segments ACKed |
Reimplemented from ns3::TcpNewReno.
Definition at line 154 of file tcp-vegas.cc.
References ns3::TcpSocketState::GetCwndInSegments(), ns3::Time::GetSeconds(), GetSsThresh(), ns3::TcpNewReno::IncreaseWindow(), m_alpha, m_baseRtt, m_begSndNxt, m_beta, m_cntRtt, ns3::TcpSocketState::m_cWnd, m_doingVegasNow, m_gamma, ns3::TcpSocketState::m_lastAckedSeq, m_minRtt, ns3::TcpSocketState::m_nextTxSequence, ns3::TcpSocketState::m_segmentSize, ns3::TcpSocketState::m_ssThresh, max, ns3::Time::Max(), min, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC(), and ns3::TcpNewReno::SlowStart().
Referenced by TcpVegasTest::DoRun().
|
virtual |
Compute RTTs needed to execute Vegas algorithm.
The function filters RTT samples from the last RTT to find the current smallest propagation delay + queueing delay (minRtt). We take the minimum to avoid the effects of delayed ACKs.
The function also min-filters all RTT measurements seen to find the propagation delay (baseRtt).
tcb | internal congestion state |
segmentsAcked | count of segments ACKed |
rtt | last RTT |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 98 of file tcp-vegas.cc.
References ns3::Time::IsZero(), m_baseRtt, m_cntRtt, m_minRtt, min, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by TcpVegasTest::DoRun().
|
private |
Alpha threshold, lower bound of packets in network.
Definition at line 158 of file tcp-vegas.h.
Referenced by GetTypeId(), and IncreaseWindow().
|
private |
Minimum of all Vegas RTT measurements seen during connection.
Definition at line 161 of file tcp-vegas.h.
Referenced by IncreaseWindow(), and PktsAcked().
|
private |
Right edge during last RTT.
Definition at line 165 of file tcp-vegas.h.
Referenced by EnableVegas(), and IncreaseWindow().
|
private |
Beta threshold, upper bound of packets in network.
Definition at line 159 of file tcp-vegas.h.
Referenced by GetTypeId(), and IncreaseWindow().
|
private |
Number of RTT measurements during last RTT.
Definition at line 163 of file tcp-vegas.h.
Referenced by EnableVegas(), IncreaseWindow(), and PktsAcked().
|
private |
If true, do Vegas for this RTT.
Definition at line 164 of file tcp-vegas.h.
Referenced by DisableVegas(), EnableVegas(), and IncreaseWindow().
|
private |
Gamma threshold, limit on increase.
Definition at line 160 of file tcp-vegas.h.
Referenced by GetTypeId(), and IncreaseWindow().
|
private |
Minimum of all RTT measurements within last RTT.
Definition at line 162 of file tcp-vegas.h.
Referenced by EnableVegas(), IncreaseWindow(), and PktsAcked().