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
geth takes over an hour to start with a lot of keys in the keystore #16874
Comments
The time before node starting is the sync time, you can check out #16875 (comment) to see more |
This is before syncing ever starts. These are the 1st two lines of geth output. |
Same issue here with 1.8.10 - also a powerful machine and previously synced up to block ~5770000. Only a few keys on this one. |
Any update on this? It persists in 1.8.12. |
At least in my case it does seem to be related to having a lot of keys, I renamed my keystore folder and it started up right away as would be expected. |
@jsvisa Yep, just tried this on another machine with the same result. |
@Crypto2 How much keys under keystore do you have? I'm try to start geth with 100 keys and no more much time to start in my local macOS. |
Several million, they should be loaded/scanned in another thread or something? |
Any updates on this? |
Any updates? Still takes hours to start. If I start it with keystore renamed then move the files back in will it at least scan them in the background then even if it takes a long time? So we can process the blockchain and do things besides sending at least? |
@jsvisa Any updates? I can do the rename as indicated in my last post but it takes nearly a day for the keys to scan in the background. There has to be some way to speed this up? |
How many keys do you have in your keystore? And what are your cache settings? |
@Crypto2 could you provide your startup flags ? |
~4.5 million keys Using: geth --ipcdisable --rpc --rpcapi "eth,net,web3,personal,admin,debug" --cache 16384 --syncmode fast --gcmode archive |
@Crypto2 thanks for the info - this is most likely the cause of the delay then. Can you elaborate a bit on your use-case? Why do you need 4.5 million keys in your keystore? |
So, fun fact, although the filename contains the address, geth doesn't rely on that. Instead, geth opens every one of those 4.5 million keys and checks the address within, and places them in a cache, to provide mappings from address to file. But I'm also curious why 4.5 million keys would be useful. A crypto exchange might want to consider using custom software to manage accounts in bulk -- geth is mainly trying to be a general usecase node. If there were some simple way of optimizing away that check, that'd be one thing, but that's not really feasible. |
one thing that could be done for sure:
I could imagine optimizations that could be done there - e.g. cache the address->file mapping - but I am not sure this should be done as it really looks like the wrong tool is used for the job in this case. |
Yes it's a hosted wallet. If we knew it was going to be an issue beforehand we would have tried to do something different; it wasn't until years in that it became a problem. I would say there for sure should be some kind of address <-> file mapping since addresses have to be unlocked before use that's the perfect time for it to actually try to load and decrypt the key. |
Any update on this to load the keys faster and/or in the background? |
This is a feature that could be implemented in Clef but it's far from obvious. |
Any updates on this? Such as:
|
Hi,
This has been going on for a long time but geth takes longer and longer to start up. Currently using the pre-compiled 1.8.10 on Linux 64-bit. Pretty beefy machine with 128GB of RAM, NVMe storage, 3 GHz Xeon w/ 8 cores / 16 threads.
My best guess is it's because we have a lot of keys since it's for a wallet provider.
Quick example from today showing timestamps between these 2 lines of geth output:
The text was updated successfully, but these errors were encountered: