15. 建议的 SCTP 协议参数值
本章总结关键 SCTP 协议参数的推荐值.
15.1. RTO 参数
- RTO.Initial: 3 秒 (3000 ms)
- RTO.Min: 1 秒 (1000 ms)
- RTO.Max: 60 秒 (60000 ms)
- RTO.Alpha: 1/8 (0.125) - SRTT 平滑因子
- RTO.Beta: 1/4 (0.25) - RTTVAR 平滑因子
15.2. 最大重传限制
- Association.Max.Retrans: 10 次尝试
- Path.Max.Retrans: 5 次尝试
- Max.Init.Retransmits: 8 次尝试
15.3. Cookie 参数
- Valid.Cookie.Life: 60 秒 (范围: 1-60 秒)
15.4. Heartbeat 参数
- Heartbeat.Interval: 30 秒 (可配置: 10-60 秒)
- Heartbeat.Max.Burst: 1
15.5. 延迟确认
- SACK.Delay: 200 ms (最大: 500 ms)
- SACK.Freq: 每 2 个分组发送一个 SACK
15.6. 拥塞控制
- Initial cwnd: min(4 * MTU, max(2 * MTU, 4380 bytes))
- Initial ssthresh: 对等方通告的接收方窗口 (a_rwnd)
- Max.Burst: 4 个 PMTU 大小的分组
- Minimum cwnd: 1 * MTU
15.7. 流和队列参数
- MIS (Maximum Inbound Streams): 65535 (最大值)
- OS (Outbound Streams): 10 (默认值) 或由应用指定
15.8. 缓冲区大小
- Receive Window: 至少 64KB, 最优值: 带宽时延积 (Bandwidth-Delay Product, BDP)
- Send Buffer: 至少与接收窗口相同
15.9. Path MTU Discovery
- Initial PMTU: IPv4: 576 字节 (保守) 或 1500 字节 (Ethernet); IPv6: 1280 字节
- PMTU Probe Interval: 10 分钟
15.10. 定时器
- T1-init, T1-cookie, T2-shutdown: 初始值: RTO.Initial, 最大值: RTO.Max, 指数退避
- T3-rtx: 按目的地维护的 RTO, 动态调整
15.11. 参数调优建议
高时延网络
- 增加 RTO.Initial: 5-10 秒
- 增加 Heartbeat.Interval: 60 秒
- 增加 Receive Window: 基于 BDP
- 增加 Max.Burst: 6-8 个分组
低时延网络
- 降低 SACK.Delay: 50-100 ms
- 降低 Heartbeat.Interval: 10-15 秒
有损网络
- 增加 Path.Max.Retrans: 7-10
- 增加 Association.Max.Retrans: 15
- 更频繁的 heartbeat: 15-20 秒
移动/无线网络
- 增加 RTO.Initial: 5 秒
- 增加所有重传限制
- 更积极的 heartbeat: 10-15 秒
总结
要点: 这些是推荐值, 不是强制值; 实现可以根据环境调整; 应提供配置接口; 应在生产环境中验证.
调优原则: 从推荐值开始, 监测性能, 逐步调整, 记录变更, 在生产环境中验证.