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

unit-e consumes too much memory on sync #1073

Open
Ruteri opened this issue May 7, 2019 · 2 comments
Open

unit-e consumes too much memory on sync #1073

Ruteri opened this issue May 7, 2019 · 2 comments
Assignees
Labels
bug A problem of existing functionality resource usage Issues related to usage of resources such as memory or CPU

Comments

@Ruteri
Copy link
Member

Ruteri commented May 7, 2019

When syncing node from the testnet the client quickly eats up all of the RAM and is killed by the OOM killer.

To reproduce it is enough to try to sync the node. It is especially easy to reproduce when having good connection with the node used for syncing.

I've identified that the issue is finalization state which is stored for every header+commits message received during header+commits sync. The state repository is not pruned fast enough as the validation lags far behind the sync and the effect is that the node consumes enormous amounts of memory (30GBs during first 40k blocks).

@frolosofsky further identified two issues:

  • The commits are synced too far ahead
  • Individual finalization states consume too much memory

Limiting the allowed offset between tip and synced headers should be enough to ensure proper resources usage during sync.

The state repository data could use some optimization too, as most of the states don't differ in any way (only differences arise when checkpoints are reached or there are commits on the chain - usually once or twice per epoch). In the attached Massif's output one can see that individual finalization state takes up to 4MBs of memory (at around 40k height).

@Ruteri Ruteri added bug A problem of existing functionality resource usage Issues related to usage of resources such as memory or CPU labels May 7, 2019
@dtr-org dtr-org deleted a comment from mergeable bot May 7, 2019
@Ruteri
Copy link
Member Author

Ruteri commented May 7, 2019

massif.out.txt.zip

@thothd
Copy link
Member

thothd commented May 7, 2019

Good catch, in general and by syncing few times, I'd strongly consider limiting the commits based sync to the fast sync use case only. There it's essential to iterate over the commits only, while in full sync we anyway need to download full blocks for validation. In full sync, the node anyway needs to download the full blocks.
Commits should still, of course, be validated epoch by epoch thus allowing but by taking them from the block and eliminating duplicate download of the full commits history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A problem of existing functionality resource usage Issues related to usage of resources such as memory or CPU
Projects
None yet
Development

No branches or pull requests

3 participants