tcp-hybla
2016-01-21 13:43
1071 查看
hybla算法针对不同RTT的连接使用不同的慢启动和拥塞避免策略
基本思想
D = 25ms
T = max(rtt/8D, 1)
R = max(rtt/D, 8) - (T << 3)
以 8D 为间隔对连接RTT进行分级 T, T 中又细分8小级 R
慢启动阶段:
每级 cwnd 基本增长值为 (2^T - 1)
每小级每次额外增长 (2^T * (F(R)/128 - 1)) 个窗口
拥塞避免阶段:
每级 cwnd 基本增长值为 (T^2 / cwnd)
具体实现
基本思想
D = 25ms
T = max(rtt/8D, 1)
R = max(rtt/D, 8) - (T << 3)
以 8D 为间隔对连接RTT进行分级 T, T 中又细分8小级 R
慢启动阶段:
每级 cwnd 基本增长值为 (2^T - 1)
每小级每次额外增长 (2^T * (F(R)/128 - 1)) 个窗口
拥塞避免阶段:
每级 cwnd 基本增长值为 (T^2 / cwnd)
具体实现
static int rtt0 = 25; static inline void hybla_recalc_param (struct sock *sk) { struct hybla *ca = inet_csk_ca(sk); /* T = rh0 = max(rtt/8D, 1) */ ca->rho_3ls = max_t(u32, tcp_sk(sk)->srtt / msecs_to_jiffies(rtt0), 8); ca->rho = ca->rho_3ls >> 3; ca->rho2_7ls = (ca->rho_3ls * ca->rho_3ls) << 1; ca->rho2 = ca->rho2_7ls >>7; } static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) { ... /* R = max(rtt/D, 8) - (T << 3) */ rho_fractions = ca->rho_3ls - (ca->rho << 3); if (tp->snd_cwnd < tp->snd_ssthresh) { is_slowstart = 1; /* * increment = 2^T * F(R) - 128 */ increment = ((1 << ca->rho) * hybla_fraction(rho_fractions) )- 128; } else { increment = ca->rho2_7ls / tp->snd_cwnd; if (increment < 128) tp->snd_cwnd_cnt++; } /* * float increment / 128 = (2^T * F(R) - 128) / 128 * = (2^T * (F(R)-128+128)) / 128 - 1 * = 2^T + 2^T * (F(R)-128)/128 - 1 * = (2^T - 1) + (2^T * (F(R)-128) / 128) * = (2^T - 1) + (2^T * (F(R)/128 - 1)) */ odd = increment % 128; tp->snd_cwnd += increment >> 7; ca->snd_cwnd_cents += odd; /* check when fractions goes >=128 and increase cwnd by 1. */ while (ca->snd_cwnd_cents >= 128) { tp->snd_cwnd++; ca->snd_cwnd_cents -= 128; tp->snd_cwnd_cnt = 0; } /* check when cwnd has not been incremented for a while */ if (increment == 0 && odd == 0 && tp->snd_cwnd_cnt >= tp->snd_cwnd) { tp->snd_cwnd++; tp->snd_cwnd_cnt = 0; } ... }
相关文章推荐
- 书评:《算法之美( Algorithms to Live By )》
- 动易2006序列号破解算法公布
- Ruby实现的矩阵连乘算法
- C#插入法排序算法实例分析
- 超大数据量存储常用数据库分表分库算法总结
- C#数据结构与算法揭秘二
- C#冒泡法排序算法实例分析
- 算法练习之从String.indexOf的模拟实现开始
- C#算法之关于大牛生小牛的问题
- C#实现的算24点游戏算法实例分析
- TCP版backshell的VBS脚本代码
- c语言实现的带通配符匹配算法
- 浅析STL中的常用算法
- 算法之排列算法与组合算法详解
- C++实现一维向量旋转算法
- Ruby实现的合并排序算法
- C#折半插入排序算法实现方法
- 基于C++实现的各种内部排序算法汇总
- C++线性时间的排序算法分析
- C++实现汉诺塔算法经典实例