Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change congestion control algorithms per connection

The command 'sysctl' in linux as of now changes the congestion control algorithm globally for the entire system. But congestion control, where the TCP window size and other similar parameters are varied, are normally done per TCP connection. So my question is:

  • Does there exist a way where I can change the congestion control algorithm being used per TCP connection?

Or am I missing something trivial here? If so, what is it?

like image 641
Hrishikesh Murali Avatar asked Jan 14 '11 07:01

Hrishikesh Murali


People also ask

What is the best TCP congestion algorithm?

CUBIC is the recommended, and currently most popular congestion control/avoidance algorithm, it is the default in Linux since kernel 2.6.

How does TCP determine the transmission rate when doing congestion control?

A TCP connection controls its transmission rate by limiting its number of transmitted-but-yet-to-be-acknowledged segments. Let us denote this number of permissible unacknowledged segments as w, often referred to as the TCP window size.

What are different congestion control algorithms?

A leaky bucket execution and a token bucket execution are predominantly used for traffic shaping algorithms. This algorithm is used to control the rate at which traffic is sent to the network and shape the burst traffic to a steady traffic stream. The figure shows the leaky bucket algorithm.

What will happen with the size of the congestion window in the slow start phase of the TCP congestion control algorithm?

Slow Start Phase- Initially, sender sets congestion window size = Maximum Segment Size (1 MSS). After receiving each acknowledgment, sender increases the congestion window size by 1 MSS. In this phase, the size of congestion window increases exponentially.


1 Answers

This is done in iperf using the -Z option - the patch is here.

This is how it is implemented (PerfSocket.cpp, line 93) :

    if ( isCongestionControl( inSettings ) ) {
#ifdef TCP_CONGESTION
    Socklen_t len = strlen( inSettings->mCongestion ) + 1;
    int rc = setsockopt( inSettings->mSock, IPPROTO_TCP, TCP_CONGESTION,
                 inSettings->mCongestion, len);
    if (rc == SOCKET_ERROR ) {
        fprintf(stderr, "Attempt to set '%s' congestion control failed: %s\n",
            inSettings->mCongestion, strerror(errno));
        exit(1);
    }
#else
    fprintf( stderr, "The -Z option is not available on this operating system\n");
#endif

Where mCongestion is a string containing the name of the algorithm to use

like image 177
rupello Avatar answered Sep 20 '22 03:09

rupello