Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endless Indexing #106

Open
Krokochik opened this issue Aug 29, 2024 · 16 comments
Open

Endless Indexing #106

Krokochik opened this issue Aug 29, 2024 · 16 comments

Comments

@Krokochik
Copy link

Krokochik commented Aug 29, 2024

I awaited for indexing complete, got a message about compacting finished, the folder with electrs now uses 800 gb, but i still keep getting messages about indexing, the http server is unavailable. I restarted electrs 16 hours ago (after compaction finished and i started get indexing messages), but it seems electrs is not synced.

362565207-41aff4fb-383c-4af5-b2ac-42da3d3b11af

@murbot
Copy link

murbot commented Sep 27, 2024

@Krokochik, did you get anywhere with this? I'm in exactly the same boat, and it's so slow. The system io, cpu and memory are all very low (close to 0), so there don't appear to be any bottlenecks.

@Krokochik
Copy link
Author

Krokochik commented Sep 27, 2024

@Krokochik, did you get anywhere with this? I'm in exactly the same boat, and it's so slow. The system io, cpu and memory are all very low (close to 0), so there don't appear to be any bottlenecks.

Sadly, the only thing I came up is to use electrs instead of esplora 'cause esplora was indexing over 3 weeks and even didn't complete for that period. Please let me know if you get smth

@murbot
Copy link

murbot commented Sep 27, 2024

@Krokochik, did you get anywhere with this? I'm in exactly the same boat, and it's so slow. The system io, cpu and memory are all very low (close to 0), so there don't appear to be any bottlenecks.

Sadly, the only thing I came up is to use electrs instead of esplora 'cause esplora was indexing over 3 weeks and even didn't complete for that period. Please let me know if you get smth

Ok, thanks for letting me know. I've exhausted all my resources at this point, so I think I'll abort and switch to romanz/electrs as well. What a shame.

@shesek
Copy link
Collaborator

shesek commented Sep 29, 2024

There are two indexing stages, one for adding transactions and for one indexing history, each followed by rocksdb compaction.

The logs should show "adding transactions from N blocks", then compaction, then "indexing history from N blocks", then another final compaction.

I restarted electrs (after compaction finished and i started get indexing messages)

It seems that you finished the first stage but not the second before restarting, and that the "indexing" messages are normal and just means that it did not finish indexing yet.

@shesek
Copy link
Collaborator

shesek commented Sep 29, 2024

(As an aside, for personal use you probably should enable --lightmode, which reduces storage requirements and makes the first stage significantly faster)

@Krokochik
Copy link
Author

There are two indexing stages, one for adding transactions and for one indexing history, each followed by rocksdb compaction.

The logs should show "adding transactions from N blocks", then compaction, then "indexing history from N blocks", then another final compaction.

I restarted electrs (after compaction finished and i started get indexing messages)

It seems that you finished the first stage but not the second before restarting, and that the "indexing" messages are normal and just means that it did not finish indexing yet.

Yes, "indexing" messages are completely normal, but what is not normal is that the second indexing stage lasts over 3 weeks on powerfuly machine with ssd. About --lightmode: as you say, the first index stage completed so I have no need to accelerate it. I also need esplora not for personal, but public use

@Krokochik
Copy link
Author

Also as you can see CPU usage time is significantly lower than executing time, so I'm confident this is an issue

@Krokochik
Copy link
Author

Also now I switched to original romanz/electrs and that indexing finished in about 9 hours

@shesek
Copy link
Collaborator

shesek commented Sep 29, 2024

Looking at your log messages it appears that its indexing nearly 600 blocks every 10 minutes, or nearly 1 block per second, which seems reasonable. Did it slow down significantly when it reached more recent (and heavier) blocks?

lasts over 3 weeks ... CPU usage time is significantly lower than executing time

It's difficult to tell why without more information. One possibility is that it doesn't saturate CPU due to a bottleneck with your SSD.

Also now I switched to original romanz/electrs and that indexing finished in about 9 hours

romanz/electrs has different design trade-offs and indeed uses a much more lightweight index. If it’s meeting your needs, it might be a good idea to stick with it.

@Krokochik
Copy link
Author

As I could remember, it was indexing 1 blk*.dat file every 10 mins, and it seems to be absurd since bitcoin has 4523 block files, i.e. indexing should take approximately 45230min=31day. The ssd has speed about 7400mb/s. Ideally I need esplora index designed for public use, but I can't wait so much

@Krokochik
Copy link
Author

Now I checked and yeah, on the 2nd stage it is indexing 1 blk*.dat file per ~10 minutes (on another machine now). This issue is critical

Screenshot 2024-09-30 174311

@pokrovskyy
Copy link

Same experience. Currently at history sync, its beyond slow. Currently projecting around 1 week sync. SSD is high-speed datacenter-grade, CPU barely touched, RAM at 10%. I would assume this should maybe get parallelized somehow because currently it does not seem hit any viable bottlenecks. Will keep it running for a week and see where it gets me. Would settle for original esplora but this one has some useful endpoints I need + HTTP API, so would still give it a try! But indexing should be significantly improved IMO

@Krokochik
Copy link
Author

I'd say you have no chance to make index just in a week, but anyway please give us know what happen

@pokrovskyy
Copy link

I have re-done the math this morning and timed .blk file processing average (on the history phase). So far I'm getting 75s per one .blk file. All .blk files are about the same size, so I suppose it does not matter that average Bitcoin block gets bigger over time (just less blocks per .blk file). With 4k files left should be in fact 3.5 days. I'll try to not forget and update you here how it goes.

On bottleneck tracking:

  • during 95% of the 75s interval there are no writes with avg 25mb/s reads (waaay below my SSD capacity)
  • then there is quick table dump to history RocksDB store
  • CPU utilization is under 20%, memory at 11%

IDK what's the deal here, but it sure seems it can use some optimization, it seems the bottleneck is somewhere in the logic and not in the resources

@pokrovskyy
Copy link

Well, although indexing continues at projected pace (at 30% now), I will be aborting the sync. Ended up switching to https://github.com/cculianu/Fulcrum - took around 6 hrs to fully sync (160GB final index) and it works blazing fast (comparing to original https://github.com/romanz/electrs). Also put together a simple Nodejs HTTP API wrapper as a replacement for Explora's HTTP API, so no reason to continue with Esplora's backend sync (for my particular use-case)

@Krokochik
Copy link
Author

I wonder if esplora maintainers are going to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants