Import of locally mined block takes more than 3 seconds #9070
Description
I'm running:
- Which Parity version?: 1.10.9
- Which operating system?: Linux
- How installed?: binaries
- Are you fully synchronized?: yes
- Which network are you connected to?: ethereum mainnet
- Did you try to restart the node?: yes
Given the current Ethereum network conditions we observed that it takes Parity sometimes up to 3 second to import a locally mined block and propagate it to other nodes.
We managed to capture a full timeline of one such example:
2018-07-08T18:29:38+02:00 --> Valid PoW solution of block 5928241 was found and an HTTP eth_submitWork call was issues to the local parity node
2018-07-08T18:29:41+02:00 (3 seconds later) --> The local notify work http handler was called (defined via --notify-work)
2018-07-08T18:29:41+02:00 --> The eth_submitWork call returned with the result of the call (true)
Log from the block import from the local parity node:
2018-07-08 18:29:41 Imported #5928241 a4b9…a114 (158 txs, 7.96 Mgas, 3647.12 ms, 26.53 KiB)
2018-07-08 18:29:41 Submitted block imported OK. #5928241: a4b911fab46a88dbb1db760352a48527bd1421b85c565df85b9ee5636373a114
Log from the block import from a remote parity node (with a direct connection to the node that mined the block):
2018-07-08 18:29:41 Imported #5928241 a4b9…a114 (158 txs, 7.96 Mgas, 74.20 ms, 26.53 KiB)
Which means that more than 3 seconds were spent between a block solution being found an the block being propagated to other nodes. This represents over 20% of the normal Ethereum block time and might be an explanation for the high uncle rate we are currently observing.
The parity node is running on a dedicated server with a local NVMe disk, 32 GB of RAM and a 4GHz CPU and the following settings: --cache-size=20000 --notify-work= --relay-set strict --force-sealing --reseal-on-txs "none" --reseal-on-uncle --tx-queue-gas=auto
I admit, this is an extrem example, but generally we see from our logs that locally submitted block take ~ 10 times more to be imported compared to the normal block import speed (while a remote block gets imported in around ~50-100ms a locally mined block takes between 300-1000ms).
Ideally the new block should be propagated to the network before any other local work is done. Also the import time seem to be directly correlated with the amount of transactions in the block / pool as we see nearly instant import times on Ethereum Classic blocks.