bsc icon indicating copy to clipboard operation
bsc copied to clipboard

BSC node sync is way slower than Ethereum node sync (arm64)

Open manelio opened this issue 5 years ago • 2 comments

I have two Raspberry Pi 4, 8 GB RAM. Each one with the same version of Ubuntu and connected via USB 3 to a 1TB SSD. So, identical hardware and software on both cases.

I want to run a full node on BSC and another on Ethereum.

Command for Ethereum node (arm64 official build):

geth --datadir /mnt/storage/ethnode/geth --cache 4096 --http --http.addr "0.0.0.0" --http.vhosts "*" --http.corsdomain "*" --http.port "8545" --http.api "web3, eth, db, net,txpool, personal, debug, account" --ws --ws.port 8546 --ws.addr "0.0.0.0" --ws.origins "*" --ws.api "web3, eth" --maxpeers=100

For BSC node, I built the executable on my laptop like this:

xgo --deps=https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 --targets=linux/arm64 github.com/binance-chain/bsc/cmd/geth

And then copied it to Raspberry.

Command for BSC node:

geth --config /mnt/storage/bscnode/config.toml --syncmode fast --datadir /mnt/storage/bscnode/node --pprofaddr 0.0.0.0 --metrics --pprof

Params of interest (I have been playing with them, but no success):

[Eth]
NetworkId = 56
SyncMode = "fast"
NoPruning = false
NoPrefetch = false
LightPeers = 100
UltraLightFraction = 75
DatabaseCache = 512
DatabaseFreezer = ""
TrieCleanCache = 256
TrieDirtyCache = 256
TrieTimeout = 100000000000
EnablePreimageRecording = false
EWASMInterpreter = ""
EVMInterpreter = ""

[Node.P2P]
MaxPeers = 25

SSD benchmark for BSC node:

root@ubuntu:~# sudo hdparm -tT /dev/sda2 

/dev/sda2:
Timing cached reads:   1584 MB in  2.00 seconds = 792.79 MB/sec
Timing buffered disk reads: 630 MB in  3.00 seconds = 209.94 MB/sec

SSD benchmark for Ethereum node:

root@ubuntu:~# sudo hdparm -tT /dev/sda2 

/dev/sda2:
Timing cached reads:   1536 MB in  2.00 seconds = 768.96 MB/sec
Timing buffered disk reads: 648 MB in  3.01 seconds = 215.42 MB/sec

Very similar.

I did a first sync of BSC node from my high-end laptop. I don't remember how many days it took and then copied the data directory to Raspberry SSD.

Both nodes was working for weeks. But there was a power outage and both nodes stopped. The gap was of around 6 days.

After a restart, the Ethereum node reached the head state in some hours and is working normally. But the BSC node is taking ages:

INFO [03-13|11:14:42.787] Imported new chain segment               blocks=10  txs=475  mgas=134.828 elapsed=8.985s    mgasps=15.005 number=5480244 hash=0cf352…89f2cb age=5d15h49m dirty=234.31MiB
INFO [03-13|11:14:51.014] Imported new chain segment               blocks=8   txs=765  mgas=105.459 elapsed=8.226s    mgasps=12.820 number=5480252 hash=48780b…4c4099 age=5d15h49m dirty=237.03MiB
INFO [03-13|11:15:03.765] Persisted trie from memory database      nodes=169235 size=53.38MiB time=6.039565072s gcnodes=234952 gcsize=90.92MiB  gctime=2.528278879s livenodes=386112 livesize=20.86MiB
INFO [03-13|11:15:03.766] Imported new chain segment               blocks=7   txs=823  mgas=104.265 elapsed=12.752s   mgasps=8.176  number=5480259 hash=9cb093…1cee38 age=5d15h49m dirty=173.06MiB
INFO [03-13|11:15:11.987] Imported new chain segment               blocks=10  txs=751  mgas=101.306 elapsed=8.220s    mgasps=12.323 number=5480269 hash=e58ea7…787fa1 age=5d15h48m dirty=180.13MiB
INFO [03-13|11:15:20.666] Imported new chain segment               blocks=10  txs=1030 mgas=133.192 elapsed=8.678s    mgasps=15.347 number=5480279 hash=d407a2…41bbdc age=5d15h48m dirty=188.81MiB
INFO [03-13|11:15:28.668] Imported new chain segment               blocks=8   txs=1655 mgas=122.688 elapsed=8.002s    mgasps=15.331 number=5480287 hash=5ea53e…c7c572 age=5d15h48m dirty=194.74MiB
INFO [03-13|11:15:31.617] Deep froze chain segment                 blocks=62  elapsed=385.445ms number=5390291 hash=bef167…c10b03
INFO [03-13|11:15:37.886] Imported new chain segment               blocks=11  txs=606  mgas=124.143 elapsed=9.217s    mgasps=13.468 number=5480298 hash=0d1d35…666253 age=5d15h47m dirty=201.48MiB

I'm wondering if there's something wrong with the params I'm using or with the current version or with the way I built the geth executable. I'm a bit lost right now.

Any thoughts on this? Thanks.

manelio avatar Mar 13 '21 11:03 manelio

Hi, @manelio . Bsc is a faster blocking chain comparing to Ethereum, the TPS is about twice of Ethereum now. It is normal it takes more time to catch up. Some other params to tuning the performance, like: TrieTimeout = 100000000000 and --cache

unclezoro avatar Mar 13 '21 13:03 unclezoro

Hey, I am facing the same issue with the Bsc chain, it's been lagging for last <100 blocks, since one day. And was using a cache size of 4096 too. Did yours catch up anytime?

chiragpandya7 avatar Mar 17 '21 18:03 chiragpandya7