Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Block import should be at least 100bps #1206

Closed
gnunicorn opened this issue Dec 4, 2018 · 7 comments
Closed

Block import should be at least 100bps #1206

gnunicorn opened this issue Dec 4, 2018 · 7 comments
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task.
Milestone

Comments

@gnunicorn
Copy link
Contributor

investigating #448 we are seeing continuous 100% CPU (caused by one thread per one core) if we run --validator --chain dev --key Alice, even without any other nodes connected. We are not seeing this, if the node is not the proposer. However if we link up the proposing node with another node, we are also seeing a continuous 100% CPU usage of two threads on that second node. This suggests we are looping without necessity in the importing thread.

@gnunicorn gnunicorn added the I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. label Dec 4, 2018
@gnunicorn gnunicorn added this to the 1.0 (final) milestone Dec 4, 2018
@jordy25519
Copy link
Contributor

jordy25519 commented Dec 6, 2018

I can't repro this with a lone proposer node on latest master.

When syncing I observe CPU usage at 100% on the import queue thread but I guess this is the expected behaviour as blocks are being on boarded. CPU usage drops off once fully synced.

@gnunicorn
Copy link
Contributor Author

@Holygits are you running node in the --dev configuration? Because in there you'd be the only one proposing blocks and do that every 4seconds, means you never "stop syncing". Here with a Dell XPS13 2017, this takes longer than 4seconds itself, thus creating a continuous 100% CPU usage. It shouldn't take this long for empty blocks to be imported (it certainly didn't in the past).

@jordy25519
Copy link
Contributor

I've run this command: substrate --validator --chain dev --key Alice and can see fluctuations from 0-20% CPU at the most.
I'm running on a Macbook Pro w 3.1 GHz Intel Core i5

Here with a Dell XPS13 2017, this takes longer than 4seconds itself, thus creating a continuous 100% CPU usage

Ah. So this problem occurs when the block import rate is slower than block proposal rate.
Seems like reproducing this maybe hardware specific

@jordy25519
Copy link
Contributor

Should've mentioned I'm running a release build.
I've just tried running the same command above with a debug build and it periodically shoots upto ~98% CPU usage.

@xlc
Copy link
Contributor

xlc commented Dec 6, 2018

Yeah debug build block importing is not usable

2018-12-06 23:27:47 Syncing  0.2 bps, target=#19164 (2 peers), best: #16508 (0x2fe2…b9a4)
2018-12-06 23:27:52 Syncing  0.4 bps, target=#19164 (2 peers), best: #16510 (0x0115…2964)
2018-12-06 23:27:57 Syncing  0.4 bps, target=#19164 (2 peers), best: #16512 (0x05b3…b869)

Release build is much faster (still not fast enough though)

2018-12-06 23:33:49 Syncing  6.8 bps, target=#19204 (2 peers), best: #16560 (0x0027…a45b)
2018-12-06 23:33:54 Syncing  6.8 bps, target=#19204 (2 peers), best: #16594 (0x57d5…765d)
2018-12-06 23:33:59 Syncing  6.6 bps, target=#19205 (2 peers), best: #16627 (0xbafa…cb4b)```

@gavofyork gavofyork changed the title continous 100% CPU (potentially in import thread) Block import is slow Dec 18, 2018
@gavofyork gavofyork changed the title Block import is slow Block import should be at least 100bps Dec 18, 2018
@gavofyork gavofyork modified the milestones: 1.0 (final), 1.0gamma Dec 18, 2018
@bkchr
Copy link
Member

bkchr commented Dec 21, 2018

This function is the dominating function in my traces when syncing. I'm currently trying to improve the performance.
By switching the hash function, I'm already seeing an improvement, from 20-26bps to 40bps.

@gavofyork
Copy link
Member

Currently seeing a steady 170bps during sync.

lamafab pushed a commit to lamafab/substrate that referenced this issue Jun 16, 2020
* Companion for Substrate paritytech#6123

* Update Substrate
liuchengxu pushed a commit to liuchengxu/substrate that referenced this issue May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task.
Projects
None yet
Development

No branches or pull requests

5 participants