QuarkChain / go-ethereum

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
5 stars 2 forks source link

Sync slow when started as a storage mining node #143

Closed syntrust closed 1 year ago

syntrust commented 1 year ago

System information

Expected behavior

Sync fast till the latest block.

Actual behavior

  1. Slow syncing with the following log. Notice that it takes 1 sec to sync 2 blocks.

    INFO [04-23|10:49:07.725] Finalizing commit of block               height=11171 hash=c95194..a7d4bc
    INFO [04-23|10:49:08.839] Finalizing commit of block               height=11172 hash=b2a00d..d6ae92
    INFO [04-23|10:49:10.009] Finalizing commit of block               height=11173 hash=c37745..353a3c
    INFO [04-23|10:49:10.226] Finalizing commit of block               height=11174 hash=96a52b..4cde23
    INFO [04-23|10:49:11.341] Finalizing commit of block               height=11175 hash=5a1217..0890dc
    INFO [04-23|10:49:11.728] Finalizing commit of block               height=11176 hash=7b431f..edcfe8
    ...
  2. Sync fast until block 10xxx and continue with the slow syncing when shutdown the node and restart, while the latest block is 12xxx.

Steps to reproduce the behavior

Remove chain data in geth folder and restart the node with the following sstorage params

--sstorage.shard=128k,0 \
--sstorage.file="/root/data/node/ss0.dat" \
--sstorage.mine=true \ 
--sstorage.minercontract="0x0000000000000000000000000000000003330001" \ 
--sstorage.txsigner=0x2cff0b8e36522eba76f6f5c328d58581243882e4 \ 
ping-ke commented 1 year ago

The sync slow is because this node is set as a validator, so after syncing to the latest block, it needs to verify and commit the block again. so it will be slow. To make it sync fast, you can run the node without --mine, after sync to the latest node, stop it and restart with --mine.

syntrust commented 1 year ago

Verified that it syncs fast without --mine:

INFO [05-05|09:22:52.737] Downloader queue stats                   receiptTasks=643 blockTasks=14169 itemSize=8.51KiB throttle=8192
INFO [05-05|09:22:52.780] Imported new block receipts              count=696  elapsed=40.115ms    number=11272 hash=574233..c65a8d age=1d14h35m  size=8.30MiB
INFO [05-05|09:22:52.966] Imported new block headers               count=1    elapsed="380.803µs" number=27297 hash=c85fd1..71ba4f
INFO [05-05|09:22:53.428] Imported new block receipts              count=355  elapsed=25.842ms    number=11627 hash=c19b5e..0866d8 age=1d13h34m  size=4.05MiB
INFO [05-05|09:22:54.099] Imported new block receipts              count=451  elapsed=41.973ms    number=12078 hash=1f08ae..329f55 age=1d12h13m  size=6.07MiB
INFO [05-05|09:22:54.737] Imported new block receipts              count=416  elapsed=25.946ms    number=12494 hash=eceb27..b7a833 age=1d11h8m   size=4.06MiB
INFO [05-05|09:22:55.406] Imported new block receipts              count=619  elapsed=39.106ms    number=13113 hash=c61df9..53388c age=1d9h29m   size=6.09MiB
INFO [05-05|09:22:56.027] Imported new block receipts              count=344  elapsed=19.588ms    number=13457 hash=912d9d..02752b age=1d8h27m   size=4.05MiB
INFO [05-05|09:22:56.675] Imported new block receipts              count=552  elapsed=30.474ms    number=14009 hash=acf88f..8493a8 age=1d6h50m   size=6.08MiB
INFO [05-05|09:22:57.338] Imported new block receipts              count=613  elapsed=36.716ms    number=14622 hash=35f854..65332a age=1d5h5m    size=6.09MiB

And after fully synced, restart with --mine worked as expected.

syntrust commented 1 year ago

Close as working as expected on 39d81ce