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 AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter #16214

Closed
michaeljmarshall opened this issue Jun 24, 2022 · 2 comments · Fixed by #16286
Closed
Labels
good first issue Good for newcomers

Comments

@michaeljmarshall
Copy link
Member

Is your enhancement request related to a problem? Please describe.
In reading through the AbstractTopic code, I noticed that there are some inefficient stat generations. Specifically:

public long getMsgOutCounter() {
return getStats(false, false, false).msgOutCounter;
}
public long getBytesOutCounter() {
return getStats(false, false, false).bytesOutCounter;
}

Describe the solution you'd like
Based on quickly reading through the usages of these methods and the definition of getStats, I think we should find a more direct way to compute the values for these counters.

Additional context
I am happy to help review any PRs for this enhancement.

@nahguam
Copy link
Contributor

nahguam commented Jun 29, 2022

I can look at this one

nahguam pushed a commit to nahguam/pulsar that referenced this issue Jun 29, 2022
…16214)

### Motivation

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

### Modification

Provided a scoped implementation of the above methods for the single
counter required for each getter.
nahguam pushed a commit to nahguam/pulsar that referenced this issue Jun 29, 2022
…16214)

### Motivation

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

### Modification

Provided a scoped implementation of the above methods for the single
counter required for each getter.
RobertIndie pushed a commit that referenced this issue Jul 1, 2022
…#16286)

### Motivation

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

### Modification

Provided a scoped implementation of the above methods for the single
counter required for each getter.
@michaeljmarshall
Copy link
Member Author

@nahguam - thanks for contributing the fix for this issue!

Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this issue Jul 5, 2022
…16214) (apache#16286)

### Motivation

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

### Modification

Provided a scoped implementation of the above methods for the single
counter required for each getter.
codelipenghui pushed a commit that referenced this issue Jul 10, 2022
…#16286)

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

Provided a scoped implementation of the above methods for the single
counter required for each getter.

(cherry picked from commit 07c46fe)
nicoloboschi pushed a commit to datastax/pulsar that referenced this issue Jul 11, 2022
…16214) (apache#16286)

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

Provided a scoped implementation of the above methods for the single
counter required for each getter.

(cherry picked from commit 07c46fe)
(cherry picked from commit 63a3762)
wuxuanqicn pushed a commit to wuxuanqicn/pulsar that referenced this issue Jul 14, 2022
…16214) (apache#16286)

### Motivation

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

### Modification

Provided a scoped implementation of the above methods for the single
counter required for each getter.
nahguam pushed a commit to nahguam/pulsar that referenced this issue Jul 25, 2022
…16214) (apache#16286)

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

Provided a scoped implementation of the above methods for the single
counter required for each getter.

(cherry picked from commit 07c46fe)
nahguam pushed a commit to nahguam/pulsar that referenced this issue Aug 4, 2022
…16214) (apache#16286)

AbstractTopic#getBytesOutCounter and AbstractTopic#getMsgOutCounter
both generate full stats only to pick the single required counter for
the getters. These can be optimised to perform only the necessary work
to calculate the counters.

Provided a scoped implementation of the above methods for the single
counter required for each getter.

(cherry picked from commit 07c46fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants