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 upgradable read lock for pubkey cache #6190

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

michaelsproul
Copy link
Member

Proposed Changes

Small optimisation to avoid taking a write lock on the pubkey_cache during block processing in the common case where no new validators are deposited.

An upgradable read lock does not exclude other readers, so this reduces contention on the lock and may make certain ops faster. An upgradable read does exclude other upgradable reads, but seeing as we expect to only be importing ~1 block at a time, this should rarely occur.

This seemed to show a small improvement in attestation verification times when I was benchmarking with @kevaundray & @jimmygchen yesterday, although we didn't quite control all our variables properly so I'll be repeating that experiment shortly.

Additional Info

We will likely refactor & consolidate the pubkey cache at some point in the near future, but until then I think this is a nice improvement, albeit minor.

@michaelsproul michaelsproul added ready-for-review The code is ready for review optimization Something to make Lighthouse run more efficiently. labels Jul 26, 2024
Copy link
Member

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

Looks good!

@jimmygchen jimmygchen added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Jul 26, 2024
@jimmygchen
Copy link
Member

@mergify queue

Copy link

mergify bot commented Jul 26, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at f4ddc45

mergify bot added a commit that referenced this pull request Jul 26, 2024
@mergify mergify bot merged commit f4ddc45 into sigp:unstable Jul 26, 2024
28 checks passed
@michaelsproul michaelsproul deleted the upgradable-pubkey-lock branch August 4, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Something to make Lighthouse run more efficiently. ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants