Skip to content

Decrease a relay buffer size for MIPS devices#421

Merged
9seconds merged 1 commit intomasterfrom
mips-save-mem
Mar 29, 2026
Merged

Decrease a relay buffer size for MIPS devices#421
9seconds merged 1 commit intomasterfrom
mips-save-mem

Conversation

@9seconds
Copy link
Copy Markdown
Owner

This is a logical continuation of @dolonet work on reducing memory overhead per connection. Since we have started to support MIPS hardware, it makes sense to have some optimizations in this regard.

Usually those devices are consumer hardware that runs either RouterOS or different flavors of OpenWRT. These devices are very limited in resources, so none gonna run large scale there. In this case it makes sense to decrease memory usage there by trading CPU cycles.

I haven't measured an impact because do not have such device available at this moment but here is how Opus measured a connection requirements:

Component Size
Relay buffers (2×16KB) ~33 KB
Goroutine stacks (2×) ~33 KB
Doppel write buffer ~16 KB
TLS state (bufio + readBuf) ~8 KB
Doppel conn state ~4 KB
Other (cipher, ctx, wrappers) ~1 KB
Total ~95 KB

So, if we cut relay buffer sizes from 16 to 8, this gonna make ~17% difference.

@9seconds 9seconds merged commit 0ad3a06 into master Mar 29, 2026
9 checks passed
@9seconds 9seconds deleted the mips-save-mem branch March 29, 2026 20:09
@Toki2Me
Copy link
Copy Markdown

Toki2Me commented Mar 29, 2026

в целом интересно, я везде использует микроты) можно на слабенькие версии роутеров резервные прокси повесить, посмотреть на сколько это жизнеспособно

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.

2 participants