Skip to content

Commit

Permalink
feat: update metrics and remove stale comment
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Oct 29, 2024
1 parent 0e8b55e commit 01a13fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
15 changes: 5 additions & 10 deletions packages/beacon-node/src/chain/bls/multithread/jobItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,11 @@ export async function jobItemWorkReq(job: JobQueueItem, metrics: Metrics | null)
})),
};
case JobQueueItemType.sameMessage: {
// This is slow code on main thread (mainly signature deserialization + group check).
// Ideally it can be taken off-thread, but in the mean time, keep track of total time spent here.
// As of July 2024, for a node subscribing to all subnets, with 1 signature per validator per epoch,
// it takes around 2.02 min to perform this operation for a single epoch.
// cpu profile on main thread has 250s idle so this only works until we reach 3M validators
// However, for normal node with only 2 to 7 subnet subscriptions per epoch this works until 27M validators
// and not a problem in the near future
// this is monitored on v1.21.0 https://github.com/ChainSafe/lodestar/pull/6894/files#r1687359225
const timer = metrics?.blsThreadPool.aggregateWithRandomnessMainThreadDuration.startTimer();
const {pk, sig} = await asyncAggregateWithRandomness(job.sets.map((set) => ({pk: set.publicKey, sig: set.signature})));
metrics?.blsThreadPool.aggregateWithRandomnessSets.inc(job.sets);
const timer = metrics?.blsThreadPool.aggregateWithRandomnessJobTime.startTimer();
const {pk, sig} = await asyncAggregateWithRandomness(
job.sets.map((set) => ({pk: set.publicKey, sig: set.signature}))
);
timer?.();

return {
Expand Down
10 changes: 7 additions & 3 deletions packages/beacon-node/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,13 @@ export function createLodestarMetrics(
name: "lodestar_bls_thread_pool_batchable_sig_sets_total",
help: "Count of total batchable signature sets",
}),
aggregateWithRandomnessMainThreadDuration: register.histogram({
name: "lodestar_bls_thread_pool_aggregate_with_randomness_main_thread_time_seconds",
help: "Total time performing aggregateWithRandomness on main thread",
aggregateWithRandomnessSets: register.gauge({
name: "lodestar_bls_thread_pool_aggregate_with_randomness_libuv_sets_total",
help: "Number of sets being asyncAggregateWithRandomness on libuv thread",
}),
aggregateWithRandomnessJobTime: register.histogram({
name: "lodestar_bls_thread_pool_aggregate_with_randomness_libuv_job_time_seconds",
help: "Total time performing aggregateWithRandomness on libuv thread",
buckets: [0.001, 0.005, 0.01, 0.1],
}),
pubkeysAggregationMainThreadDuration: register.histogram({
Expand Down

0 comments on commit 01a13fd

Please sign in to comment.