ord icon indicating copy to clipboard operation
ord copied to clipboard

ord index is very slow

Open 77656233 opened this issue 2 years ago • 136 comments

Hey,

my index is syncing for 2 days already and each second only 1 point of the 775k gets added. this would take 190 days to full sync the index. The first 100k starts to sync in 10 minutes and after it gets super slow.

I am on debian.

Any idea how to fix that or to speed that up?

Thanks

77656233 avatar Feb 10 '23 13:02 77656233

This can be fixed by merging #1516 and #1636 and then reverting #1357.

andrewtoth avatar Feb 10 '23 14:02 andrewtoth

@andrewtoth I have merged https://github.com/casey/ord/pull/1516 and https://github.com/casey/ord/pull/1636 and reverted https://github.com/casey/ord/pull/1357. It gets to the value set in the --first-inscription-height parameter very quickly. However, afterwards it is extremely slow taking around 1 minute per block. I have built using the cargo build -r command. Any other ideas?

joel-carter avatar Feb 10 '23 16:02 joel-carter

Did you start bitcoind with -rest or add rest=1 in bitcoin.conf?

andrewtoth avatar Feb 10 '23 16:02 andrewtoth

Yes bitcoind is running with the -rest flag

joel-carter avatar Feb 10 '23 16:02 joel-carter

If you run with RUST_LOG=warn before the ord command does it warn that it can't connect to REST?

andrewtoth avatar Feb 10 '23 16:02 andrewtoth

No there are no warnings output at all. See below Screenshot 2023-02-10 at 16 36 46

Update: It does seem to be using the rest endpoint as when I stop bitcoind running I get the warning that it can't connect to REST.

joel-carter avatar Feb 10 '23 16:02 joel-carter

Ok, the first blocks are the slowest because every input has to be fetched. As it indexes more blocks, it will already have the previous inputs so less inputs need to be fetched from disk. It is definitely slower than what I experienced though. 1 minute for a block is too long. What type of hard drive are you using?

andrewtoth avatar Feb 10 '23 16:02 andrewtoth

It is a virtual HDD with google cloud. Seems to max out at around 80 MiB/s (~600mbps if I am correct), but ord and bitcoind are using a fraction of that. (5-15 MiB/s at most). cpu utilisation is about 1-3% for both processes together too. Ram is 16GB and only using around 600MB

joel-carter avatar Feb 10 '23 16:02 joel-carter

got it working with compile 0.4.2 and using a bootrap file from community

77656233 avatar Feb 10 '23 17:02 77656233

@ChristianGrieger could you share further details please?

joel-carter avatar Feb 10 '23 17:02 joel-carter

  1. git clone https://github.com/casey/ord
  2. cd folder
  3. git checkout 0.4.2
  4. cargo build -r
  5. download bootstrap file, rename it to index.redb.gz and place/unzip it in /root/.local/share/ord

wget 'https://s3.amazonaws.com/octal.eth/index.redb.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVY3HUS3MKQ7N5W5V%2F20230204%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230204T180540Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=db0cf7243e0cced65a5d228714db8fc13f483671bda2860d1264de2ecf84289d'

  1. run ord wallet balance
  2. done ✅😅

77656233 avatar Feb 10 '23 17:02 77656233

This can be fixed by merging #1516 and #1636 and then reverting #1357.

any chance we can get an executable for this? i'm on 2 days of indexing and its a pain in the ass

mmikeww avatar Feb 10 '23 18:02 mmikeww

I cloned the repo with git clone main repo link After switched branche to 4.0.2 with git checkout 4.0.2 build it after and added a bootstrap file from community for the db and started it. or what you want to know?

Where did you get the file from?

jpc4r avatar Feb 11 '23 00:02 jpc4r

This can be fixed by merging #1516 and #1636 and then reverting #1357.

Any help for us git-illiterates?

so7ow avatar Feb 11 '23 01:02 so7ow

Any help for us git-illiterates?

Added the speedup improvements in my branch https://github.com/andrewtoth/ord/tree/speedup-improvements if you'd like to help test/benchmark.

git clone https://github.com/andrewtoth/ord
cd ord
git checkout speedup-improvements
cargo build --release

Make sure you set rest=1 in bitcoin.conf or run bitcoind -txindex -rest

andrewtoth avatar Feb 11 '23 01:02 andrewtoth

git clone [email protected]:andrewtoth/ord

% git clone [email protected]:andrewtoth/ord Cloning into 'ord'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

so7ow avatar Feb 11 '23 02:02 so7ow

Updated the post, use git clone https://github.com/andrewtoth/ord instead.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

Now

Updated the post, use git clone https://github.com/andrewtoth/ord instead.

now fails on cargo line with: zsh: command not found: cargo

so7ow avatar Feb 11 '23 02:02 so7ow

Oh I assumed you'd have rust installed. Install rust first, which includes cargo. After the cargo build line you can find ord at ./target/release/ord.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

Whoops had a bad merge in there. Fixed. Do a git pull and try again.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

Success!! Will report back.

so7ow avatar Feb 11 '23 02:02 so7ow

I didn't get too far! Running ord:

error: Manual upgrade required. Expected file format version 109, but file is version 107

so7ow avatar Feb 11 '23 02:02 so7ow

Ahh this has a newer db version. You'll have to nuke your previous index file. It should be in ~/.local/share/ord if you're on linux. Just rm ~/.local/share/ord/index.redb.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

But... that's 3 day's worth of work! 🥴

Will this new one be fast enough to catch me up?

so7ow avatar Feb 11 '23 02:02 so7ow

Ahh you can specify a new index file. Run ord --index ./index.redb index and it will create one in your current directory.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

Well! It just ran through all the indexing in ~10 seconds and returned:

error: Can't assign requested address (os error 49)

so7ow avatar Feb 11 '23 02:02 so7ow

I think I'm wrong, it didn't quite finish all the indexing. It zipped right up to 766244/775968 and then crashed out. If I run it again it goes through a few more blocks and crashes out again.

so7ow avatar Feb 11 '23 02:02 so7ow

Yeah it blows through everything until block 767430 in about 10 seconds, then it takes me a little over an hour to sync to tip. Are you running bitcoind on default port? Do you have rest enabled? Not sure haven't hit that error. Any other configs for your bitcoind?

andrewtoth avatar Feb 11 '23 02:02 andrewtoth

Yes, default port. Yes to rest. txindex=1 in bitcoin.conf server: true in settings.json

Other than that, vanilla, I think.

so7ow avatar Feb 11 '23 02:02 so7ow

Hmm not sure what's happening. What OS are you running? It's connecting properly to the P2P interface to be able to sync all headers. It might be breaking on REST. Try running bitcoind with rest=0 and see if it syncs. It will be much slower but if it doesn't break then there's a bug with my REST patch.

andrewtoth avatar Feb 11 '23 02:02 andrewtoth