Skip to content

Conversation

@fregie
Copy link
Contributor

@fregie fregie commented Jun 16, 2021

支持在配置文件中指定用于转发数据的buffer大小,使用io.Copy时默认buffer大小为32*1024字节,在大多数情况下这个buffer有一点大了,通过pprof分析发现也是这里占用了多一半的内存。

使用 32 * 1024大小的buffer的内存占用:
截图_选择区域_20210616163636

使用 4 * 1024大小的buffer的内存占用:
截图_选择区域_20210616163756

实际测试中,1000并发连接,使用32 * 1024的buffer内存占用峰值有90-100M,改为4 * 1024后峰值为30-40M.
@Loyalsoldier @p4gefau1t

@fregie
Copy link
Contributor Author

fregie commented Jul 6, 2021

需要该功能的同学可以先用我的分支构建,同时修复了���些其他bug,增加了数据持久化等新功能。
https://github.com/fregie/trojan-go/tree/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant