-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
memory allocation optimisations? #707
Comments
I don't see an obvious way to remove the allocation from the timer path; Go doesn't expose any other methods for managing low-level timers without allocating a new one each time. I suppose in the common case we might be able to re-use the same The protocol decoding could plausibly use pools in some places, but it's not high on our list of priorities right now. We'd be happy to take PRs though. |
Maybe use time.NewTimer replace time.After is better, we can control when to release the memory .If large numbers of partitionConsumer there,the memory rise very fast and can not be released immediately according to my test.
|
Oh good point, I somehow missed that |
yesss. this looks awesome.
|
this is sarama, 1baff7c, aka a git checkout 10 days old.
i noticed my app's doing a lot of allocations and am trying to reduce them. so here's some insights from a heap profile while my app is running and consuming
the NewTimer is from time.After which is from responseFeeder:
I tried the following patch, which unfortunately does not work.
the reason is it will always allocate new stuff, apparently:
beyond that, you can see there's some more sarama stuff where allocations happen.
maybe those can be solved by some sync.Pool usage or some otherwise reusing of buffers?
The text was updated successfully, but these errors were encountered: