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

Disable stats recorder for built-in PulsarClient #12217

Conversation

BewareMyPower
Copy link
Contributor

Motivation

In PulsarService, there's a built-in client used in many places, like topic compaction, system topics read/write. It could also be used in protocol handlers. Different with the manually created Pulsar client, it can read the configured authentication params and TLS related configs for broker-to-broker communication.

However, it doesn't change the default statsIntervalSeconds config, which means each time a producer/consumer/reader is created, a stats recorder (ProducerStatsRecorderImpl or ConsumerStatsRecorderImpl) will be created, in which there's a Netty TimerTask that prints stats periodically (the default interval is 1 minute). If there're many producers/consumers/readers created by this built-in client, the unnecessary CPU usage will be high.

Modifications

Configure the statsIntervalSeconds with zero value to disable stats recorder.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

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

LGTM.

If we find that we are interested in these stats, I think it makes more sense to update the implementation to add them to the results returned by the metrics endpoint instead of hide the stats in logs. Technically, this could be useful for client applications as well. The pulsar go client creates prometheus metrics, and I've found those very useful.

@codelipenghui codelipenghui added this to the 2.9.0 milestone Sep 28, 2021
@315157973
Copy link
Contributor

My only concern is that some users conduct some business analysis by collecting this log. At least this change needs to be explained in the Release, right?

@BewareMyPower
Copy link
Contributor Author

My only concern is that some users conduct some business analysis by collecting this log. At least this change needs to be explained in the Release, right?

Yeah, you're right. Anyway it's a trade-off. And I'm curious about how can we explain it in release notes?

@BewareMyPower BewareMyPower merged commit 52232e6 into apache:master Sep 28, 2021
@BewareMyPower BewareMyPower deleted the bewaremypower/disable-stats-recorder branch September 28, 2021 14:14
codelipenghui pushed a commit that referenced this pull request Sep 29, 2021
### Motivation

In `PulsarService`, there's a built-in client used in many places, like topic compaction, system topics read/write. It could also be used in protocol handlers. Different with the manually created Pulsar client, it can read the configured authentication params and TLS related configs for broker-to-broker communication.

However, it doesn't change the default `statsIntervalSeconds` config, which means each time a producer/consumer/reader is created, a stats recorder (`ProducerStatsRecorderImpl` or `ConsumerStatsRecorderImpl`) will be created, in which there's a Netty `TimerTask` that prints stats periodically (the default interval is 1 minute). If there're many producers/consumers/readers created by this built-in client, the unnecessary CPU usage will be high.

### Modifications

Configure the `statsIntervalSeconds` with zero value to disable stats recorder.

(cherry picked from commit 52232e6)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Sep 29, 2021
eolivelli pushed a commit to datastax/pulsar that referenced this pull request Nov 23, 2021
### Motivation

In `PulsarService`, there's a built-in client used in many places, like topic compaction, system topics read/write. It could also be used in protocol handlers. Different with the manually created Pulsar client, it can read the configured authentication params and TLS related configs for broker-to-broker communication.

However, it doesn't change the default `statsIntervalSeconds` config, which means each time a producer/consumer/reader is created, a stats recorder (`ProducerStatsRecorderImpl` or `ConsumerStatsRecorderImpl`) will be created, in which there's a Netty `TimerTask` that prints stats periodically (the default interval is 1 minute). If there're many producers/consumers/readers created by this built-in client, the unnecessary CPU usage will be high.

### Modifications

Configure the `statsIntervalSeconds` with zero value to disable stats recorder.

(cherry picked from commit 52232e6)
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation

In `PulsarService`, there's a built-in client used in many places, like topic compaction, system topics read/write. It could also be used in protocol handlers. Different with the manually created Pulsar client, it can read the configured authentication params and TLS related configs for broker-to-broker communication.

However, it doesn't change the default `statsIntervalSeconds` config, which means each time a producer/consumer/reader is created, a stats recorder (`ProducerStatsRecorderImpl` or `ConsumerStatsRecorderImpl`) will be created, in which there's a Netty `TimerTask` that prints stats periodically (the default interval is 1 minute). If there're many producers/consumers/readers created by this built-in client, the unnecessary CPU usage will be high.

### Modifications

Configure the `statsIntervalSeconds` with zero value to disable stats recorder.
@congbobo184 congbobo184 added cherry-picked/branch-2.9 Archived: 2.9 is end of life release/2.9.4 labels Nov 10, 2022
congbobo184 pushed a commit that referenced this pull request Nov 10, 2022
### Motivation

In `PulsarService`, there's a built-in client used in many places, like topic compaction, system topics read/write. It could also be used in protocol handlers. Different with the manually created Pulsar client, it can read the configured authentication params and TLS related configs for broker-to-broker communication.

However, it doesn't change the default `statsIntervalSeconds` config, which means each time a producer/consumer/reader is created, a stats recorder (`ProducerStatsRecorderImpl` or `ConsumerStatsRecorderImpl`) will be created, in which there's a Netty `TimerTask` that prints stats periodically (the default interval is 1 minute). If there're many producers/consumers/readers created by this built-in client, the unnecessary CPU usage will be high.

### Modifications

Configure the `statsIntervalSeconds` with zero value to disable stats recorder.

(cherry picked from commit 52232e6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.8.2 release/2.9.0 release/2.9.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants