更改每个连接的拥塞控制算法

Hri*_*ali 5 linux congestion-control sysctl

linux 中的“sysctl”命令现在全局更改了整个系统的拥塞控制算法。但是拥塞控制,其中 TCP 窗口大小和其他类似参数是变化的,通常是每个 TCP 连接完成的。所以我的问题是:

  • 是否存在一种方法可以更改每个 TCP 连接使用的拥塞控制算法?

还是我在这里遗漏了一些微不足道的东西?如果是,那是什么?

rup*_*llo 5

这是在iperf 中使用 -Z 选项完成的 - 补丁在这里

这是它的实现方式(PerfSocket.cpp,第 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
Run Code Online (Sandbox Code Playgroud)

其中mCongestion是包含要使用的算法名称的字符串


ism*_*ail -1

Linux 具有可插入的拥塞算法,可以更改动态使用的算法,但这是系统范围的设置,而不是针对每个连接。