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

Perf[MQB]: inline stats onEvent #542

Merged
merged 15 commits into from
Dec 16, 2024

Conversation

tepamid
Copy link
Contributor

@tepamid tepamid commented Dec 10, 2024

Describe your changes
Refactor QueueStatsDomain, DomainStats, ClusterNodeStats and BrokerStats to make function onEvent inline which supposedly should increase overall performance of the system.

Testing performed

  • Run github pipeline with UT and IT

Additional context

@678098 678098 self-assigned this Dec 11, 2024
@678098 678098 self-requested a review December 11, 2024 07:40
Signed-off-by: Dmitry Petukhov <[email protected]>
@tepamid tepamid force-pushed the perf-inline-stats-onevent branch from 0796ed0 to 982aac0 Compare December 11, 2024 08:08
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Have some comments. Overall, the PR is good and is almost ready to be merged

src/groups/mqb/mqbstat/mqbstat_brokerstats.h Outdated Show resolved Hide resolved
inline void
BrokerStats::onEvent<BrokerStats::EventType::Enum::e_CLIENT_CREATED>()
{
BSLS_ASSERT_SAFE(d_statContext_p && "initialize was not called");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not in the scope of this PR, but It's a pity that we check this condition on every metric update. Would be nice to ensure initialization on construction, so Stats classes are impossible to construct without this.

src/groups/mqb/mqbstat/mqbstat_clusterstats.h Outdated Show resolved Hide resolved
src/groups/mqb/mqbstat/mqbstat_domainstats.h Show resolved Hide resolved
src/groups/mqb/mqbstat/mqbstat_domainstats.h Show resolved Hide resolved

/// Namespace for the constants of stat values that applies to the queues
/// on the domain
struct DomainQueueStats {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also might be a private type for QueueStatsDomain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can not make it private, because it's used in QueueStatsUtil::initializeTableAndTipDomains
My suggestion is to put struct DomainQueueStats into public section in class QueueStatsDomain

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can do it in the next PR

src/groups/mqb/mqbstat/mqbstat_queuestats.h Show resolved Hide resolved
src/groups/mqb/mqbstat/mqbstat_queuestats.h Show resolved Hide resolved
src/groups/mqb/mqbstat/mqbstat_queuestats.h Show resolved Hide resolved
} break;
};
}

void QueueStatsDomain::onEvent(EventType::Enum type,
bsls::Types::Int64 value,
const bsl::string& appId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This onEvent (per-appId one) is not templated/inlined in this PR. It's okay, we can do it later.

tepamid and others added 6 commits December 11, 2024 20:22
Co-authored-by: Evgeny Malygin <[email protected]>
Signed-off-by: Dmitry Petukhov <[email protected]>
Co-authored-by: Evgeny Malygin <[email protected]>
Signed-off-by: Dmitry Petukhov <[email protected]>
Co-authored-by: Evgeny Malygin <[email protected]>
Signed-off-by: Dmitry Petukhov <[email protected]>
678098
678098 previously approved these changes Dec 14, 2024
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Changes are good

@tepamid tepamid marked this pull request as ready for review December 16, 2024 11:20
@tepamid tepamid requested a review from a team as a code owner December 16, 2024 11:20
@tepamid tepamid force-pushed the perf-inline-stats-onevent branch from 9128dec to c233c42 Compare December 16, 2024 12:59
@tepamid
Copy link
Contributor Author

tepamid commented Dec 16, 2024

Merged with upstream main. All workflows passed

@678098 678098 merged commit 5a6670d into bloomberg:main Dec 16, 2024
30 checks passed
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.

2 participants