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

Reduce allocations in consumers #6039

Merged
merged 3 commits into from
Oct 24, 2024
Merged

Reduce allocations in consumers #6039

merged 3 commits into from
Oct 24, 2024

Conversation

neilalexander
Copy link
Member

This PR makes the following changes that should reduce allocations in consumers:

  • JSApiConsumerGetNextRequest structs are now pooled, as they were unavoidably escaping to the heap;
  • waitingRequest structs are now returned to the pool correctly if hitting MaxWaiting;
  • Reuse the hdr buffer from pooled jsPubMsg when returning consumer errors to the client.

Signed-off-by: Neil Twigg [email protected]

Otherwise a lot of allocations escape to the heap due to the `json.Unmarshal()`.

Signed-off-by: Neil Twigg <[email protected]>
@neilalexander neilalexander requested a review from a team as a code owner October 24, 2024 14:49
@neilalexander neilalexander marked this pull request as draft October 24, 2024 15:05
@neilalexander neilalexander marked this pull request as ready for review October 24, 2024 15:10
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit c432281 into main Oct 24, 2024
5 checks passed
@derekcollison derekcollison deleted the neil/nextreqfrommsg branch October 24, 2024 17:49
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.

3 participants