Skip to content

feat(clients): NetworkReceive memory optimization#3098

Open
surajdarade wants to merge 5 commits intoAutoMQ:mainfrom
surajdarade:feature/networkreceive-memory-optimization
Open

feat(clients): NetworkReceive memory optimization#3098
surajdarade wants to merge 5 commits intoAutoMQ:mainfrom
surajdarade:feature/networkreceive-memory-optimization

Conversation

@surajdarade
Copy link
Copy Markdown
Contributor

@surajdarade surajdarade commented Dec 10, 2025

Fixes #2962 [ Enhancement/Optimization ]

Clean MemoryPool implementation at NetworkReceive:

  • Lazy creation of buffer via MemoryPool
  • readFrom() - Allocation Failure - return head (prevent attempt to a payload without memory)
  • readFrom() - Readable execution flow
  • close() - Buffer ownership optimization - removed buffer != EMPTY_BUFFER (before buffer was not allocated through the MemoryPool, now being allocated through MemoryPool, MemoryPool now becomes single owner for all payload buffers)

…er pool and tiered bucket allocation for commonpayload sizes to reduce GC overhead and memory fragmentation.
@surajdarade
Copy link
Copy Markdown
Contributor Author

Any update on this? @superhx , @Gezi-lzq

@superhx
Copy link
Copy Markdown
Collaborator

superhx commented Dec 15, 2025

@surajdarade Thank you for your PR. The expectation of the ISSUE is to add a new MemoryPool implementation to optimize the memory usage of NetworkReceive.

@surajdarade
Copy link
Copy Markdown
Contributor Author

Thanks for redirecting. Will refactor as per the intended requirement now.

…ted via MemoryPool, returning head in allocation failure preventing payload read without memory
@surajdarade
Copy link
Copy Markdown
Contributor Author

Have a look on this proposed optimization, let me know what can we improved, what revamp is needed.

@superhx
Copy link
Copy Markdown
Collaborator

superhx commented Dec 23, 2025

Have a look on this proposed optimization, let me know what can we improved, what revamp is needed.

Hi, the requirement is to implement a new MemoryPool to optimize memory usage. Currently, SocketServer.memoryPool uses MemoryPool.NONE by default.

@github-actions
Copy link
Copy Markdown

This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch)

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions bot added the Stale label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]Optimize the memory allocation of NetworkReceive

2 participants