reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::GeneralCongestionManager Class Reference

This is a general-purpose congestion manager. More...

#include <GeneralCongestionManager.hxx>

Inheritance diagram for resip::GeneralCongestionManager:
[legend]

Public Types

enum  MetricType { SIZE =0 , TIME_DEPTH , WAIT_TIME }
 Enumeration of congestion metric types this class supports. More...
 
- Public Types inherited from resip::CongestionManager
enum  RejectionBehavior { NORMAL =0 , REJECTING_NEW_WORK =1 , REJECTING_NON_ESSENTIAL =2 }
 

Public Member Functions

 GeneralCongestionManager (MetricType defaultMetric, uint32_t defaultMaxTolerance)
 
virtual ~GeneralCongestionManager ()
 
virtual bool updateFifoTolerances (const resip::Data &fifoDescription, MetricType metric, uint32_t maxTolerance)
 Update the metric type and tolerances of a given fifo that the GeneralCongestionManager is already aware of.
 
virtual void registerFifo (resip::FifoStatsInterface *fifo, MetricType metric, uint32_t maxTolerance)
 Add a fifo to the collection of fifos monitored by this CongestionManager, with a specified metric and maximum tolerance.
 
virtual void registerFifo (resip::FifoStatsInterface *fifo)
 Add a fifo to the collection of fifos monitored by this CongestionManager, with the default metric and maximum tolerance.
 
virtual void unregisterFifo (resip::FifoStatsInterface *fifo)
 Remove a fifo from the collection of fifos monitored by this CongestionManager.
 
virtual RejectionBehavior getRejectionBehavior (const FifoStatsInterface *fifo) const
 Gets the current RejectionBehavior for this fifo, based only on the congestion-state of this fifo (ie; this ignores the congestion-state of other fifos in the system).
 
virtual uint16_t getCongestionPercent (const FifoStatsInterface *fifo) const
 Returns the percent of maximum tolerances that this queue is at.
 
virtual void logCurrentState () const
 Log the current state of all monitored fifos.
 
virtual EncodeStream & encodeCurrentState (EncodeStream &strm) const
 Get the current state of all monitored fifos.to a stream.
 
- Public Member Functions inherited from resip::CongestionManager
 CongestionManager ()
 Constructor.
 
virtual ~CongestionManager ()
 

Detailed Description

This is a general-purpose congestion manager.

It is not conscious of the roles of the fifos it manages, or the relationships between these fifos/roles. In other words, if a crucial fifo is fully congested, this will have no bearing on whether the other fifos in the system are considered congested. In many cases, this is a workable restriction, but it may be desirable to implement a subclass of CongestionManager that takes the system as a whole into account when determining whether a specific fifo should be considered congested. For more on implementing such a congestion manager, see the class documentation for CongestionManager.

Definition at line 24 of file GeneralCongestionManager.hxx.

Member Enumeration Documentation

◆ MetricType

Enumeration of congestion metric types this class supports.

Enumerator
SIZE 

The current size of the fifo.

TIME_DEPTH 

The age of the oldest item in the fifo.

WAIT_TIME 

The expected service time (the time it takes for new items to be serviced) This is the recommended metric.

Definition at line 30 of file GeneralCongestionManager.hxx.

Constructor & Destructor Documentation

◆ GeneralCongestionManager()

resip::GeneralCongestionManager::GeneralCongestionManager ( MetricType  defaultMetric,
uint32_t  defaultMaxTolerance 
)
Parameters
defaultMetricThe type of metric that will be used to define a fifo's congestion state, by default:
  • SIZE : Based solely on the number of messages in the fifo
  • TIME_DEPTH : Based on the age of the oldest (front-most) message in the fifo.
  • WAIT_TIME : Based on the expected wait time for the fifo; this is calculated by multiplying the size by the average service time. This is the recommended metric.
maxToleranceThe default maximum tolerance for the given metric; this determines when the RejectionBehavior changes
  • 0-80 percent of max tolerance -> NORMAL
  • 80-100 percent of max tolerance -> REJECTING_NEW_WORK
  • >100 percent of max tolerance -> REJECTING_NON_ESSENTIAL

Definition at line 11 of file GeneralCongestionManager.cxx.

◆ ~GeneralCongestionManager()

resip::GeneralCongestionManager::~GeneralCongestionManager ( )
virtual

Definition at line 22 of file GeneralCongestionManager.cxx.

Member Function Documentation

◆ encodeCurrentState()

EncodeStream & resip::GeneralCongestionManager::encodeCurrentState ( EncodeStream &  strm) const
virtual

Get the current state of all monitored fifos.to a stream.

Implements resip::CongestionManager.

Definition at line 120 of file GeneralCongestionManager.cxx.

◆ getCongestionPercent()

uint16_t resip::GeneralCongestionManager::getCongestionPercent ( const FifoStatsInterface *  fifo) const
virtual

Returns the percent of maximum tolerances that this queue is at.

Definition at line 138 of file GeneralCongestionManager.cxx.

◆ getRejectionBehavior()

CongestionManager::RejectionBehavior resip::GeneralCongestionManager::getRejectionBehavior ( const FifoStatsInterface *  fifo) const
virtual

Gets the current RejectionBehavior for this fifo, based only on the congestion-state of this fifo (ie; this ignores the congestion-state of other fifos in the system).

For how this function determines congestion-state, see registerFifo().

Implements resip::CongestionManager.

Definition at line 71 of file GeneralCongestionManager.cxx.

◆ logCurrentState()

void resip::GeneralCongestionManager::logCurrentState ( ) const
virtual

Log the current state of all monitored fifos.

Implements resip::CongestionManager.

Definition at line 101 of file GeneralCongestionManager.cxx.

◆ registerFifo() [1/2]

virtual void resip::GeneralCongestionManager::registerFifo ( resip::FifoStatsInterface *  fifo)
inlinevirtual

Add a fifo to the collection of fifos monitored by this CongestionManager, with the default metric and maximum tolerance.

Parameters
fifoThe fifo that we are registering.

Implements resip::CongestionManager.

Definition at line 117 of file GeneralCongestionManager.hxx.

◆ registerFifo() [2/2]

void resip::GeneralCongestionManager::registerFifo ( resip::FifoStatsInterface *  fifo,
MetricType  metric,
uint32_t  maxTolerance 
)
virtual

Add a fifo to the collection of fifos monitored by this CongestionManager, with a specified metric and maximum tolerance.

Parameters
fifoThe fifo that we are registering.
metricThe type of metric that will be used to define this fifo's congestion state.
  • SIZE : Based solely on the number of messages in the fifo
  • TIME_DEPTH : Based on the age of the oldest (front-most) message in the fifo.
  • WAIT_TIME : Based on the expected wait time for the fifo; this is calculated by multiplying the size by the average service time. This is the recommended metric.
maxToleranceThe maximum tolerance for the given metric; this determines when the RejectionBehavior changes
  • 0-80 percent of max tolerance -> NORMAL
  • 80-100 percent of max tolerance -> REJECTING_NEW_WORK
  • >100 percent of max tolerance -> REJECTING_NON_ESSENTIAL

Definition at line 26 of file GeneralCongestionManager.cxx.

◆ unregisterFifo()

void resip::GeneralCongestionManager::unregisterFifo ( resip::FifoStatsInterface *  fifo)
virtual

Remove a fifo from the collection of fifos monitored by this CongestionManager.

Parameters
fifo- fifo to remove

Implements resip::CongestionManager.

Definition at line 40 of file GeneralCongestionManager.cxx.

◆ updateFifoTolerances()

bool resip::GeneralCongestionManager::updateFifoTolerances ( const resip::Data &  fifoDescription,
MetricType  metric,
uint32_t  maxTolerance 
)
virtual

Update the metric type and tolerances of a given fifo that the GeneralCongestionManager is already aware of.

Parameters
fifoDescriptionThe description of the fifo that we are modifying the tolerances of. Specify as empty to adjust all registered fifos.
metricThe type of metric that will be used to define this fifo's congestion state.
  • SIZE : Based solely on the number of messages in the fifo
  • TIME_DEPTH : Based on the age of the oldest (front-most) message in the fifo.
  • WAIT_TIME : Based on the expected wait time for the fifo; this is calculated by multiplying the size by the average service time. This is the recommended metric.
maxToleranceThe maximum tolerance for the given metric; this determines when the RejectionBehavior changes
  • 0-80 percent of max tolerance -> NORMAL
  • 80-100 percent of max tolerance -> REJECTING_NEW_WORK
  • >100 percent of max tolerance -> REJECTING_NON_ESSENTIAL
Returns
True iff the tolerances were successfully adjusted (this can fail if this GeneralCongestionManager does not know about a fifo by this name; make sure you have either called getCongestionPercent() or registerFifo() for this fifo first).
Note
Setting the CongestionManager for the resiprocate stack will cause getCongestionPercent() to be called for every fifo in the stack; you may then adjust the tolerances as you wish.

Definition at line 50 of file GeneralCongestionManager.cxx.


The documentation for this class was generated from the following files: