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

feat: track prepare next epoch time #6256

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/beacon-node/src/chain/prepareNextSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export class PrepareNextSlotScheduler {
headRoot,
isEpochTransition,
});
const lodestarPrecomputeEpochTransitionTimer = isEpochTransition
nflaig marked this conversation as resolved.
Show resolved Hide resolved
? this.metrics?.precomputeNextEpochTransition.duration.startTimer()
: null;
// No need to wait for this or the clock drift
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
Expand Down Expand Up @@ -133,6 +136,8 @@ export class PrepareNextSlotScheduler {
prepareSlot,
previousHits,
});

lodestarPrecomputeEpochTransitionTimer?.();
nflaig marked this conversation as resolved.
Show resolved Hide resolved
}

if (isExecutionStateType(prepareState)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/beacon-node/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,11 @@ export function createLodestarMetrics(
name: "lodestar_precompute_next_epoch_transition_waste_total",
help: "Total number of precomputing next epoch transition wasted",
}),
duration: register.histogram({
name: "lodestar_precompute_next_epoch_transition_duration_seconds",
help: "Duration of precomputeNextEpochTransition at lodestar side",
Copy link
Member

Choose a reason for hiding this comment

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

The "at lodestar side" might be confusing, are we precomputing the next epoch transition somewhere else (not in lodestar)?

Looking at the code the two major tasks we do are

  • precompute next epoch transition
  • and prepare execution payload

Might be missing something

Copy link
Member

Choose a reason for hiding this comment

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

There's also the prepareExecutionPayload call that's not included in this timer.

Copy link
Member

Choose a reason for hiding this comment

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

But isn't that a different task or maybe I misunderstand what is meant by precomputeEpochTransition, my assumption is this includes epoch transition + hashing the state.

From my understanding the "at lodestar side" is redundant and can be removed as the task precomputeNextEpochTransition is only executed by Lodestar.

prepareExecutionPayload is part of preparing for next slot but not part of precomputing the epoch transition.

wemeetagain marked this conversation as resolved.
Show resolved Hide resolved
buckets: [1, 2, 3, 4, 8],
}),
},

// reprocess attestations
Expand Down
Loading