Skip to content

Conversation

@jimmygchen
Copy link
Member

@jimmygchen jimmygchen commented Nov 26, 2025

Issue Addressed

Fixes attester cache write lock contention. Alternative to #8463.

Description

Deletes the attester cache which was causing lock contention across multiple hot code paths:

  1. Attestation production - Every request took a read lock to check the cache. Cache misses additionally held a write lock while loading state from disk and building committee caches, blocking all other attestation requests
  2. Block processing - Took write lock when caching block states, blocking all attestation production
  3. Finalization - Took write lock when pruning, blocking all attestation production

We now use the state cache directly via get_advanced_hot_state, which builds all caches without lock contention.

Co-authored-by: Michael Sproul <[email protected]>
@jimmygchen jimmygchen force-pushed the delete-attester-cache branch from 224fbff to ad4cf8f Compare November 26, 2025 05:06
%request_slot,
"Attester cache miss"
);
let (advanced_state_root, mut state) = self
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add metrics for the number of times we hit this code path? Would be nice to have a histogram here or instrumentation of the time spent computing the hot state

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea - I've instrumented the produce_unaggregated_attestation code path, and we already have a span for get_advanced_hot_state, so this should give us good visibility.

@dapplion
Copy link
Collaborator

Nice simplification!

@michaelsproul michaelsproul added code-quality waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Nov 27, 2025
@jimmygchen jimmygchen added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Dec 1, 2025
Copy link
Member

@eserilev eserilev left a comment

Choose a reason for hiding this comment

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

This is awesome! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-quality ready-for-review The code is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants