百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
1

1m-go-tcp-server

> 编程语言
开源

支持 100 万连接的服务器实施的基准

1.9K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

支持 100 万连接的服务器实施的基准

支持 1 万连接的服务器实现的基准

  1. 1_simple_tcp_server:基于 goroutines per connection 实现的 1M 连接服务器
  2. 2_epoll_server:基于 epoll 实现的 1M 连接服务器
  3. 3_epoll_server_throughputs:为 2_epoll_server 添加吞吐量和延迟测试
  4. 4_epoll_client:基于 epoll 实现的客户端
  5. 5_multiple_client:在客户端中使用 multiple epoll 来管理连接
  6. 6_multiple_server:在服务器中使用 multiple epoll 来管理连接
  7. 7_server_prefork:使用 Apache 的 prefork 风格来实现服务器
  8. 8_server_workerpool:使用 Reactor 设计模式来实现多个事件循环
  9. 9_few_clients_high_throughputs:用于测试吞吐量和延迟的简单的 goroutines per connection 服务器
  10. 10_io_intensive_epoll_server:一个 io-bound multiple epoll 服务器
  11. 11_io_intensive_goroutine:一个 io-bound goroutines per connection 服务器
  12. 12_cpu_intensive_epoll_server:一个 cpu-bound multiple epoll 服务器
  13. 13_cpu_intensive_goroutine:一个 cpu-bound goroutines per connection 服务器
  • 两个 E5-2630 V4 CPU, 共 20 个核心, 40 个逻辑核心。
  • 32G 内存 调整 Linux:
bash
sysctl -w fs.file-max=2000500
sysctl -w fs.nr_open=2000500
sysctl -w net.nf_conntrack_max=2000500
ulimit -n 2000500

sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_tw_reuse=1

客户端只有在收到响应后才会发送下一个请求。它没有使用"管道"风格进行测试。

基准测试

1m 连接

吞吐量 (TPS) 延迟
goroutine-per-conn 202830 4.9s
单个 epoll(服务器和客户端均为单个 epoll) 42495 23s
单个 epoll 服务器 42402 0.8s
多个 epoll 服务器 197814 0.9s
prefork 444415 1.5s
workerpool 190022 0.3s
中文介绍:
  1. 对百万个 Go TCP 连接的思考: 使用 epoll 方式减少资源占用
  2. 对百万 Go TCP 连接的思考 2: 百万连接的服务器性能
  3. [百万 G

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gobenchmarkepollgogolang

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言