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

Use thread-local RNGs for jitters #48860

Merged
merged 12 commits into from
Nov 13, 2024
Merged

Conversation

espadolini
Copy link
Contributor

This PR replaces the use of allocated RNGs for jitters with math/rand/v2's thread-local Int64N. In synthetic benchmarks this seems to result in a x100 speedup compared to both old uncontended and contended but sharded implementations.

Commits after the first are the result of mechanical refactoring consisting of progressive inlining of functions and package-level variables.

Functions in the api modules have been left in place, but rendered harmless; the two functions in lib/utils are there to support the enterprise module until it's updated.

@espadolini espadolini added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v16 backport/branch/v17 labels Nov 12, 2024
@github-actions github-actions bot added audit-log Issues related to Teleports Audit Log database-access Database access related issues and PRs discovery kubernetes-access machine-id size/sm labels Nov 12, 2024
@espadolini espadolini force-pushed the espadolini/rand-v2-jitters branch from 1564a86 to e4e6b86 Compare November 12, 2024 22:18
Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

Nice!

@espadolini espadolini added this pull request to the merge queue Nov 13, 2024
Merged via the queue into master with commit a92e49f Nov 13, 2024
39 checks passed
@espadolini espadolini deleted the espadolini/rand-v2-jitters branch November 13, 2024 16:53
@public-teleport-github-review-bot

@espadolini See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Create PR

@espadolini espadolini removed kubernetes-access audit-log Issues related to Teleports Audit Log database-access Database access related issues and PRs machine-id discovery labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants