pull down to refresh
Hey Murch,
All this is taken care of in my repro, except your point #2. I had tested with the "raspibolt" recommendation of 2GB. The problem on rpi4 is txin verification:
- Verify 9995 txins: 34716.35ms (3.473ms/txin) [51906.08s (65.15ms/blk)]but it's unlikely to be the disk or the cache! I cannot reproduce on an Odroid M2 with exactly the same disk (as in I plugged it out of the rpi4 and into the odroid) and cache settings.
I've seen some traces from others where the main issue are secp256k1 functions and I remember some changes have been made to replace hand coded ASM with "clang is better". I'm trying to find a few days to get into the weeds on this one and just create a bunch bench cases to see if I can pinpoint it without needing to pprof a live mainnet process. Worst case I'll build a regtest script and do it that way. Anything to not have to profile a mainnet bitcoind haha.
txin verification would indeed make me think that it’s the retrieval of UTXO cache misses. I’ve been hearing that the disk interface of Raspberry Pis is pretty slow, so the disk itself might not be the issue, but rather the speed at which the Pi talks to the disk?
the main issue are secp256k1 functions
Is this during the full validation part of IBD after passing the assumevalid block? Otherwise, I wouldn’t expect many calls to secp.
Mh, the default assumevalid block was 886'157 in v29.0.
Oh, you know what? I have a theory. There was a period of time when people started to churn UTXOs to sift for rare sats. Perhaps the slowdown coincides with a big increase of old UTXOs being spent?
Looking at a UTXO Age band chart, the number of coins held in UTXOs older than one year peaked in November 2023. I haven’t found data on UTXO counts itself yet.
Hmm, very interesting.
I think I can rule out #1 (power) because I tried it with a separately powered external SSD, and I still had the same IBD slowness. \
I can also rule out #5 because the SSD was not close to full, either.
All the others, I'd have to check. I don't remember what I set dbcache at, but I do remember playing around with it, setting both higher and lower, and not noticing any meaningful speed up in IBD.
Let me caveat all the following with saying that I’m not much of an expert for Raspberry Pis, disk performance, or the nitty-gritty details of IBD, but this is my understanding:
dbcacheshould be set to a value larger than the UTXO set. This would lead to swapping (i.e., writing memory contents to disk) on anything but the most powerful machines. Instead, thedbcachevalue should not be set higher than 50–75% of the RAM the device has, less if the device generally has low RAM or ifbitcoindis not the only thing you’re running.If you are running only few services on your device, and have enough RAM, you may want to turn off swapping altogether. I’m not sure whether 8 GB would be enough for that.
datadirto the SSD andblocksdirto the HDD in thebitcoin.conf.assumevalidblock will be set further in the past from the chaintip. Full script validation may make CPU load the bottleneck of a weaker device. You may be able to shave off days from IBD by setting theassumevalidblock to something close to the current block height (e.g. 1000 blocks below the chaintip).I could imagine that there are also issues with some cheaper adapters for external drives, but I know nothing concrete there. There were also several IBD performance improvements in v30, and more are coming in v31. Unfortunately, the one I’m most excited will miss v31, but will hopefully be in v32. It would be great if we also get Swiftsync in v32, but we’ll have to see about that.
Maybe @optimism can comment on what I wrote, judging from other comments in this topic, @optimism may know better about a lot of these topics than me.