gws
本次更新改进了 IO 方式, 1000 连接下峰值 IOPS 提高了约 37%, 达到了 gorilla/websocket
的 3 倍, 内存消耗降低到了和 gorilla/websocket
同一水平线. 改进细节如下:
- 使用 io.Reader 替代 io.CopyN 读数据, 避免非必要的 allocs
- 使用 net.Buffers 替代 bufio.Writer 写数据,减少内存拷贝
- 移除连接里的 bufio.Writer, 标记 WriteBufferSize 参数为废弃状态

仓库地址: https://github.com/lxzan/gws