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

When buffer gets resized, store the resized buffer in the pool #92

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

lovromazgon
Copy link
Member

Description

This PR contains a small but important change, where we make sure to return the resized buffer in the pool if needed. Previously we were always storing the default buffer (1kB) in the pool, even if it was resized to a bigger buffer in hostCall. This can be seen by observing the log messages warning about resizing the buffer for every call to the plugin:

2024-10-18T18:25:49+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183557 component=standalone.wasmProcessor processor_id=bench:foo
2024-10-18T18:25:49+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183559 component=standalone.wasmProcessor processor_id=bench:foo
2024-10-18T18:25:49+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183578 component=standalone.wasmProcessor processor_id=bench:foo
2024-10-18T18:25:50+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183623 component=standalone.wasmProcessor processor_id=bench:foo
2024-10-18T18:25:50+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183443 component=standalone.wasmProcessor processor_id=bench:foo
2024-10-18T18:25:50+00:00 WRN insufficient memory, command will be parked until next call to command_request allocated_bytes=1024 command_bytes=183492 component=standalone.wasmProcessor processor_id=bench:foo

After this change, the resizing happens only once, so only one log message is emitted.

Quick checks:

  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

@lovromazgon lovromazgon requested a review from a team as a code owner October 18, 2024 16:33
@lovromazgon lovromazgon self-assigned this Oct 18, 2024
@lovromazgon lovromazgon merged commit 306d09f into main Oct 18, 2024
3 checks passed
@lovromazgon lovromazgon deleted the lovro/buffer-resizing branch October 18, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants