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

Change expensive timer metrics to trend counters #4670

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

SirTyson
Copy link
Contributor

Description

Resolves https://github.com/stellar/stellar-core-internal/issues/336

Changes expensive timer metrics to counters.

For timer and histogram metrics, we store data points in a buffer. When this buffer "fills up" we must to a compaction step, which involves many copies. For metrics that measure short lived functions (runtime in the ns or us range) that get called very frequently, the cost of this compaction step dominates the function runtime. For example, for BucketList in memory loads, metric overhead accounted for 75% of the load's total runtime.

This changes several short lived metrics to trends instead of timer based histograms. Specifically, we no longer track individual data samples, but keep a running sum of runtime instead. This still gives us insight into trends, but no longer gives us info on individual calls. However, it is significantly cheaper runtime wise.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

marta-lokhova
marta-lokhova previously approved these changes Mar 25, 2025
Copy link
Contributor

@marta-lokhova marta-lokhova left a comment

Choose a reason for hiding this comment

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

LGTM, just one small typo. Feel free to squash the last commit and rebase.

@SirTyson
Copy link
Contributor Author

LGTM, just one small typo. Feel free to squash the last commit and rebase.

Done

@marta-lokhova marta-lokhova enabled auto-merge March 26, 2025 00:09
@marta-lokhova marta-lokhova added this pull request to the merge queue Mar 26, 2025
Merged via the queue into stellar:master with commit 14a9db1 Mar 26, 2025
13 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