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

hotfix(message/validation): optimize signer state memory usage #1874

Open
wants to merge 20 commits into
base: stage
Choose a base branch
from

Conversation

nkryuchkov
Copy link
Contributor

@nkryuchkov nkryuchkov commented Nov 22, 2024

Changes:

Calculations of signer state for 50K validators for MessageCounts:

We store the state for each validator for each of the 6 roles. For each role, we store the state, of each signer, up to 13. For each signer, we store the state of the 64 slots. Then for each slot, we store the signer state. So overall we have up to 50000 * 6 * 13 * 64 ~= 249_600_000 signer states. I'll count the maximal value but the actual value should be lower because the average amount of operators is less than 13.

So if MessageCounts is reduced from 48 bytes to 1 then in such case the max theoretical memory consumption should reduce from ~12 GB to ~250 MB

Changes in Pyroscope:

image

@nkryuchkov nkryuchkov added the optimization Something to make SSV run more efficiently label Nov 22, 2024
@nkryuchkov nkryuchkov changed the title message/validation: optimize signer state memory usage fix(message/validation): optimize signer state memory usage Nov 22, 2024
@nkryuchkov nkryuchkov changed the title fix(message/validation): optimize signer state memory usage message/validation: optimize signer state memory usage Nov 22, 2024
Copy link
Contributor

@iurii-ssv iurii-ssv 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!

message/validation/utils_test.go Outdated Show resolved Hide resolved
@nkryuchkov nkryuchkov changed the title message/validation: optimize signer state memory usage hotfix(message/validation): optimize signer state memory usage Nov 26, 2024
@nkryuchkov nkryuchkov added the critical Needs immediate attention label Nov 26, 2024
Copy link
Contributor

@MatheusFranco99 MatheusFranco99 left a comment

Choose a reason for hiding this comment

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

Great work!!
The issue I raised doesn't regard this PR, so approving :)

# Conflicts:
#	message/validation/consensus_validation.go
#	message/validation/partial_validation.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical Needs immediate attention optimization Something to make SSV run more efficiently
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants