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

Pruner should have time-dependent deletion limits #6770

Closed
Tracked by #8303
shekhirin opened this issue Feb 23, 2024 · 0 comments · Fixed by #6958
Closed
Tracked by #8303

Pruner should have time-dependent deletion limits #6770

shekhirin opened this issue Feb 23, 2024 · 0 comments · Fixed by #6958
Assignees
Labels
A-pruning Related to pruning or full node C-enhancement New feature or request

Comments

@shekhirin
Copy link
Collaborator

shekhirin commented Feb 23, 2024

Problem

Pruner has a setting for a number of entries it can delete from the database per block

/// Maximum total entries to prune (delete from database) per block.
delete_limit: usize,

We need that limit because only one database write transaction can be opened at the same time, and there's a fight for this transaction between the main Engine loop (insert new data into the database) and the Pruner (delete data from the database).

In theory, if everyone has the same hardware setup, we can find a limit that satisfies this important condition: Pruner should finish before we need to process a Forkchoice Update in the Engine loop. But in practice, it's hard and on lower-end hardware we may go beyond the allowed threshold and miss or delay an FCU.

In most of the cases, it's not a problem because the limits are set higher than the actual number of entries that's produced per block, so the Pruner finishes earlier than 100ms. BUT if we have any I/O slowdown or a huge block, we can easily go over this 100ms limit.

Solution

Current

Currently, we set the deletion limit for pruner manually, expressed in number of entries per block:

/// The delete limit for pruner, per block. In the actual pruner run it will be multiplied by
/// the amount of blocks between pruner runs to account for the difference in amount of new
/// data coming in.
#[serde(default)]
pub prune_delete_limit: usize,

For Mainnet, this number is higher because more data is produced on every block

prune_delete_limit: 3500,

And for testnets, it's lower

prune_delete_limit: 1700,

Proposal

Make the pruner limit time-dependent, i.e. allow a maximum of 100ms for the Pruner to delete any data, and stop after that and commit everything to the database, returning the control over an exclusive write transaction to the Engine loop.

That way, we will also not need any chain-dependent settings in the ChainSpec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pruning Related to pruning or full node C-enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants