Pooled memory management currently impossible with socket.io interface
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 63.2k
- Forks
- 10.3k
- Avg merge
- 11d 20h
- Merged PRs (30d)
- 2
Description
Is your feature request related to a problem? Please describe.
Currently, my application maintains reasonably large Buffer objects in a pool, reusing them to avoid tons of GC contention. However, socket.io is a bit of a black hole for those buffers. Once we .emit one, we don't know when it has been actually sent to the client and "released" from socket.io. Thus we cannot reuse those buffers and they must be GC. We're spending upwards of 60% of our CPU time in GC on these objects we send to socket.io right now.
Describe the solution you'd like
I would like socket.io to expose a released event that is emitted every time socket.io has successfully sent an object to the client. It would contain as its body the object that was released. These could be buffers, classes, POJO, etc., anything that lives on the heap and socket.io is now done with.
Describe alternatives you've considered
I don't see any alternatives at this time.
Additional context
I'd be very happy to implement this feature myself but before I spend time on it, I want to know that the solution I proposed is acceptable and the PR would likely to be merged.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. First trace the socket.io emit-to-client lifecycle and determine when emitted objects are no longer retained; then define the release event’s timing and payload, with completion shown by tests covering buffers and other emitted objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend-api-design, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100