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

Node startup performance #337

Open
sondreb opened this issue May 18, 2021 · 2 comments
Open

Node startup performance #337

sondreb opened this issue May 18, 2021 · 2 comments
Assignees
Labels
node Related to the node runtime

Comments

@sondreb
Copy link
Member

sondreb commented May 18, 2021

  • As the blockchain grows, the node startup time takes longer time.
  • This issue can be referenced by various improvements on startup.
@sondreb sondreb added the node Related to the node runtime label May 18, 2021
@sondreb sondreb self-assigned this May 18, 2021
sondreb added a commit that referenced this issue May 18, 2021
- "ChainedBlocksDataBytes" was not really used, but required loading of all headers on startup. Removed to improve performance from 52 seconds to 42 seconds.
- This was discovered independent of stratisproject/StratisFullNode#233, but linking to that issue to help Stratis and Blockcore-based blockchains to take the improvement.
- #337
sondreb added a commit that referenced this issue May 18, 2021
- This is a small improvement on the performance, there are alternative ways to do this than using Dictionary, which is a little bit faster still. This is the cleanest example, please suggest and try out improvements.
- Only the LevelDB implementation has been verified.
- #337
sondreb added a commit that referenced this issue May 18, 2021
- The deployment flags are cached when calculated as new blocks come in.
- The deployment flags are read from cache at startup, as they cannot have changed since shutdown.
- This gives a very big improvement on node startup.
- #337
@sondreb
Copy link
Member Author

sondreb commented May 18, 2021

I ran always in debug mode, one warmup before recording two runs:

Before any changes:

[2021-05-18 07:43:43.7133 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 07:44:35.6593 9] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

52 seconds

[2021-05-18 07:46:15.7802 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 07:47:06.2633 11] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

51 seconds

Fix: #338

[2021-05-18 07:51:31.1402 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 07:52:11.1038 5] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

40 seconds

[2021-05-18 07:53:29.6883 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 07:54:05.7421 9] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

42 seconds

Fix: #339

[2021-05-18 08:51:56.1037 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 08:52:45.9565 14] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

49 seconds

[2021-05-18 08:52:59.8231 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 08:53:50.0756 18] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

51 seconds

Fix: #340

[2021-05-18 11:51:44.4608 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 11:52:19.1320 8] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

35 seconds

[2021-05-18 11:52:32.8144 1] INFO: Blockcore.FullNode.Initialize Full node initialized on EXOSMain.
[2021-05-18 11:53:06.6603 7] INFO: Blockcore.AsyncWork.AsyncLoop.StartAsync PeriodicLog starting in 5 seconds.

34 seconds


Total: ~32 seconds of 52 seconds saved, had startups at 17-20 seconds on EXOS with all fixes applied.

@dangershony
Copy link
Member

This is pretty good I agree

sondreb added a commit that referenced this issue May 26, 2021
- "ChainedBlocksDataBytes" was not really used, but required loading of all headers on startup. Removed to improve performance from 52 seconds to 42 seconds.
- This was discovered independent of stratisproject/StratisFullNode#233, but linking to that issue to help Stratis and Blockcore-based blockchains to take the improvement.
- #337
sondreb added a commit that referenced this issue Jul 4, 2021
* Cache the deployment flags to improve startup

- The deployment flags are cached when calculated as new blocks come in.
- The deployment flags are read from cache at startup, as they cannot have changed since shutdown.
- This gives a very big improvement on node startup.
- #337

* Add empty constructor

- Needed for tests.

* Add null check for integration tests

* Move persisting of flags to BaseFeature

- Check the flags every minute and persist if needed.
- This only validates ScriptFlags, not BIP30/BIP34/LockTimeFlags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Related to the node runtime
Projects
None yet
Development

No branches or pull requests

2 participants