{"action":"created","issue":{"url":"https://api.github.com/repos/xtaci/kcptun/issues/278","repository_url":"https://api.github.com/repos/xtaci/kcptun","labels_url":"https://api.github.com/repos/xtaci/kcptun/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/xtaci/kcptun/issues/278/comments","events_url":"https://api.github.com/repos/xtaci/kcptun/issues/278/events","html_url":"https://github.com/xtaci/kcptun/issues/278","id":190231026,"number":278,"title":"关闭FEC后，内存使用大幅降低。","user":{"login":"bettermanbao","id":17328315,"avatar_url":"https://avatars.githubusercontent.com/u/17328315?v=3","gravatar_id":"","url":"https://api.github.com/users/bettermanbao","html_url":"https://github.com/bettermanbao","followers_url":"https://api.github.com/users/bettermanbao/followers","following_url":"https://api.github.com/users/bettermanbao/following{/other_user}","gists_url":"https://api.github.com/users/bettermanbao/gists{/gist_id}","starred_url":"https://api.github.com/users/bettermanbao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bettermanbao/subscriptions","organizations_url":"https://api.github.com/users/bettermanbao/orgs","repos_url":"https://api.github.com/users/bettermanbao/repos","events_url":"https://api.github.com/users/bettermanbao/events{/privacy}","received_events_url":"https://api.github.com/users/bettermanbao/received_events","type":"User","site_admin":false},"labels":[{"id":479409605,"url":"https://api.github.com/repos/xtaci/kcptun/labels/MEM","name":"MEM","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":31,"created_at":"2016-11-18T03:59:26Z","updated_at":"2016-11-19T01:55:38Z","closed_at":null,"body":"刚才抽空试了一些参数组合，偶尔发现FEC才是内存大量占用的元凶。\r\n\r\n先说明一下我这边的的情况：\r\n\r\n1. 魔都电信100M宽带，每天上午直连国外网站速度还行，下午开始到晚上访问国外网站速度很慢。\r\n2. kcptun部署在MT7620 + 64M内存的路由器上配合SS透明代理使用，使用的是20161105版kcptun。\r\n3. VPS是sentris的，流量一大就会被封。测试下来rcvwnd和sndwnd设置128长时间运行不会被封。\r\n\r\n参数如下，速度可以稳定在2.5Mbps以上，youtube 720p非常流畅，1080p基本流畅。\r\n因为我这边电信不同时段的丢包率差别很大，所以尝试把FEC关了，用fast2模式。FEC固定的带宽开销在丢包率低的情况下比较浪费带宽。不容让丢失的包直接用fast2的快速重传找回，这样动态带宽利用率更高。因为本身window只是128，所以带宽很宝贵。\r\n\r\n于是关闭FEC后，发现原先64M内存的路由器看一段时间视频后，可用内存必定会降到1-2M之间，现在可用内存永远维持在14M以上。CPU使用率也略微降低，但传输速度仍维持原水平。\r\n\r\n    \"crypt\": \"salsa20\",\r\n    \"mode\": \"fast2\",\r\n    \"autoexpire\": 300,\r\n    \"sndwnd\": 128,\r\n    \"rcvwnd\": 128,\r\n    \"datashard\": 0,\r\n    \"parityshard\": 0,\r\n    \"dscp\": 46,\r\n    \"nocomp\": true,\r\n\r\n所以为题来了，开FEC后的大量内存占用是正常情况吗？\r\n\r\nBTW, 下面这组加密耗时的评估源码能否提供下？我想看看在MIPS平台下运行的结果，谢谢！\r\n\r\nBenchmarkAES128-4         200000         11182 ns/op\r\nBenchmarkAES192-4         200000         12699 ns/op\r\nBenchmarkAES256-4         100000         13757 ns/op\r\nBenchmarkTEA-4             50000         26441 ns/op\r\nBenchmarkSimpleXOR-4     3000000           441 ns/op\r\nBenchmarkBlowfish-4        30000         48036 ns/op\r\nBenchmarkNone-4         20000000           106 ns/op\r\nBenchmarkCast5-4           20000         60222 ns/op\r\nBenchmarkTripleDES-4        2000        878759 ns/op\r\nBenchmarkTwofish-4         20000         68501 ns/op\r\nBenchmarkXTEA-4            20000         77417 ns/op\r\nBenchmarkSalsa20-4        300000          4998 ns/op"},"comment":{"url":"https://api.github.com/repos/xtaci/kcptun/issues/comments/261685051","html_url":"https://github.com/xtaci/kcptun/issues/278#issuecomment-261685051","issue_url":"https://api.github.com/repos/xtaci/kcptun/issues/278","id":261685051,"user":{"login":"LiR1cky","id":5634416,"avatar_url":"https://avatars.githubusercontent.com/u/5634416?v=3","gravatar_id":"","url":"https://api.github.com/users/LiR1cky","html_url":"https://github.com/LiR1cky","followers_url":"https://api.github.com/users/LiR1cky/followers","following_url":"https://api.github.com/users/LiR1cky/following{/other_user}","gists_url":"https://api.github.com/users/LiR1cky/gists{/gist_id}","starred_url":"https://api.github.com/users/LiR1cky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiR1cky/subscriptions","organizations_url":"https://api.github.com/users/LiR1cky/orgs","repos_url":"https://api.github.com/users/LiR1cky/repos","events_url":"https://api.github.com/users/LiR1cky/events{/privacy}","received_events_url":"https://api.github.com/users/LiR1cky/received_events","type":"User","site_admin":false},"created_at":"2016-11-19T01:55:38Z","updated_at":"2016-11-19T01:55:38Z","body":"梅林的固件里要稳定用kcptun需要安装插件中心里的虚拟内存，另外目前1118版的client还没更新到梅林SS插件里，更新后应该能显著降低内存消耗的。\r\n\r\n我昨晚试了下1118版，加速效果跟1111没有明显差异。内存消耗确实降低了。感谢作者提供这么好的工具！"}}
{"actor":{"display_login":"LiR1cky"}}