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

[optimize] Stop batchFlushTicker when Disable batching #720

Merged

Conversation

shoothzj
Copy link
Member

Motivation

Disable batchFlushTicker when Disable batching, reduce cpu cost

Modifications

Stop the batchFlushTicker when Disable batching

@shoothzj
Copy link
Member Author

This change is limit samllest change to the code.
Otherwise we can add a if/else in func (p *partitionProducer) runEventsLoop()

@wolfstudy

@@ -126,6 +126,9 @@ func newPartitionProducer(client *client, topic string, options *ProducerOptions
metrics: metrics,
epoch: 0,
}
if p.options.DisableBatching {
p.batchFlushTicker.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it ok to call Stop() multiple times? There is a call to stop in the internal close.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's ok

@wolfstudy wolfstudy added this to the v0.8.0 milestone Feb 10, 2022
@wolfstudy wolfstudy merged commit 8f8287f into apache:master Feb 10, 2022
@shoothzj shoothzj deleted the optimize-disable-batching-stop-batch-ticker branch February 10, 2022 03:44
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.

None yet

4 participants