大网数据广告活动
服务器运维问答

Bad throughput for single tcp connections

· 52CE 我爱测

I have a server with a Gigabit Uplink, and testing with iperf3 with 100 parallel connections i get at least 600 MBit/s, depending on the other server (i tried some public test servers). But when i run iperf3 with one connection i…

问题原文

原帖链接 · allo · CC BY-SA 3.0

I have a server with a Gigabit Uplink, and testing with iperf3 with 100 parallel connections i get at least 600 MBit/s, depending on the other server (i tried some public test servers). But when i run iperf3 with one connection i get 10-15 MBit/s, with two 20-30 MBit/s and so on.

I do not have very complicated iptables rules and no other idea, why it is so slow. What can be the limiting factor for single tcp connections, that they are 10 times slower than the possible bandwidth?

已采纳解答

原帖链接 · allo · CC BY-SA 3.0

I finally found the cause of the problem.

I had some flask webapp, which uses redis to stream events to the user. When the user disconnected, the app kept the redis pubsub connection alive, without reading data anymore.

This leads to a long Send-Q/Recv-Q, which apparently cause the tcp stack to slow down and produce kernel warnings: "TCP: out of memory -- consider tuning tcp_mem".

  • Short term fix: Kill the processes with the long packet queues.
  • Long term solution: Fixing the misbehaving programs.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。