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

fix(engineio/ws): add read_buffer_size option and set default to 4KiB #450

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

Totodore
Copy link
Owner

@Totodore Totodore commented Jan 27, 2025

Motivation

With recent changes to tokio-tungstenite, the memory usage is a lot heavier. See related issue #448.

Solution

  • Set the default read_buffer_size to 4KiB (the same value that in the previous tokio-tungstenite versions) and expose an option in socketioxide and engineioxide to manually change this value.
  • Copy the Bytes binary buffer for the partial binary packets. Otherwise the buffer is saved and the websocket read buffer needs to grow as it still has a living data bound to it.

@Totodore Totodore self-assigned this Jan 27, 2025
@Totodore Totodore added A-socketioxide Area related to socketioxide A-engineioxide Area related to engineioxide P-High High priority C-Performance Performance related issues and PRs labels Jan 27, 2025
@Totodore Totodore marked this pull request as ready for review January 27, 2025 19:37
@Totodore Totodore force-pushed the fix-ws-mem-usage branch 7 times, most recently from a338368 to 5e578d6 Compare January 27, 2025 23:40
@Totodore Totodore merged commit fe40809 into main Jan 28, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engineioxide Area related to engineioxide A-socketioxide Area related to socketioxide C-Performance Performance related issues and PRs P-High High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant