-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
看了 https://zhuanlan.zhihu.com/p/352748959 做的测试, 我用了三台ecs测试下来, 发现在端口号使用超过 3万的情况下, 使用动态绑定端口, 客户端会消耗大量的 cpu
| s.bind(new InetSocketAddress(lIp, 0)); |
// ....
Socket s = new Socket();
// 这行改成 s.bind(new InetSocketAddress(lIp, i+5000));
// 我这边实际测试, 当单个 ip 占用 端口数超过 3万时, 客户端的 cpu 会急剧上升
// 直接指定端口 s.bind(new InetSocketAddress(lIp, i+5000)); 就可以解决这个问题
s.bind(new InetSocketAddress(lIp, 0));
s.connect(new InetSocketAddress(sIp, sPort));
....
笔记链接 https://www.notion.so/C10K-cfa325eeb78145b5947b6979e6b327f1
Metadata
Metadata
Assignees
Labels
No labels