Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support specify buffer size in config #365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant