Skip to content

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Aug 7, 2025

Add 8 more metrics, each for different state category:

  • state_account_{count,bytes}: the cumsum number and bytes of account
  • state_storage_{count,bytes}: the cumsum number and bytes of storage
  • state_trienode_{count,bytes}: the cumsum number and bytes of trienode
  • state_contract_{count,bytes}: the cumsum number and bytes of contract

@jsvisa jsvisa requested a review from rjl493456442 as a code owner August 7, 2025 10:27
@jsvisa jsvisa force-pushed the state-size-metrics branch from b9f33e2 to 87e1d82 Compare August 12, 2025 04:12
@@ -187,3 +187,16 @@ func WriteTransitionStatus(db ethdb.KeyValueWriter, data []byte) {
log.Crit("Failed to store the eth2 transition status", "err", err)
}
}

// WriteStateSizeMetrics writes the state size metrics to the database
func WriteStateSizeMetrics(db ethdb.KeyValueWriter, data []byte) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to persistent the state size into database.
I would prefer to only keep them in memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If so, we need to iterate the db to calculate the init size for each restart, let me have a test how much time it needs to calculate the init size

@gballet
Copy link
Member

gballet commented Aug 12, 2025

would it be hard to also add receipts? @shazam8253 can do it otherwise.

@jsvisa
Copy link
Contributor Author

jsvisa commented Aug 13, 2025

would it be hard to also add receipts? @shazam8253 can do it otherwise.

just curious, the receipts were stored mostly in freezer, should also be considered as state size?

jsvisa and others added 22 commits August 27, 2025 15:53
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
This reverts commit 87e1d82.

Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
@jsvisa jsvisa force-pushed the state-size-metrics branch from d99afda to 6af49ca Compare August 27, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants