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

Use less frequent write transactions in persistence task #12459

Open
Rjected opened this issue Nov 12, 2024 · 0 comments
Open

Use less frequent write transactions in persistence task #12459

Rjected opened this issue Nov 12, 2024 · 0 comments
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks A-db Related to the database C-enhancement New feature or request

Comments

@Rjected
Copy link
Member

Rjected commented Nov 12, 2024

In the persistence task, we create a write transaction for every operation. Sometimes, we will be doing these persistence operations one after the other, and end up spending more time committing than we do actually writing. The write transaction can definitely be re-used in these cases. For example, it can take up to hundreds of ms, just to commit the safe block update.

We should only do this when we know we have more than one persistence action ready to process. This would mean we would have to:

  • debounce the persistence actions in the persistence task
  • open a write transaction
  • perform the persistence actions
  • commit

The methods we use in the persistence task currently do not allow us to pass around a write transaction. We may have to refactor some methods inside of the persistence task, and may have to refactor some methods inside of providers. These should be separate changes, not done all at once.

@Rjected Rjected added A-blockchain-tree Related to sidechains, reorgs and pending blocks A-db Related to the database C-enhancement New feature or request labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks A-db Related to the database C-enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant