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

geth full node is too slow.Only about 50 blocks can be synchronized per minute. #27747

Closed
chinaliuhan opened this issue Jul 19, 2023 · 23 comments

Comments

@chinaliuhan
Copy link

chinaliuhan commented Jul 19, 2023

geth full node is too slwo.Only about 50 blocks can be synchronized per minute

However I use snap mode to sync very quickly.

Unfortunately what I need receipts for all transactions.

this is my server:

  • CPU 16
  • Memory 30G
  • SSD 10T
  • Bandwidth 10G
  • net.peerCount 300

this is my geth:

./geth --syncmode full --gcmode archive --maxpeers 500 --cache 2000 
./prysm.sh beacon-chain --accept-terms-of-use=true 

What should I do to increase the sync speed? It's been a week and only 5 million blocks have been synced. At this rate, it will never be finished.

@s1na
Copy link
Contributor

s1na commented Jul 19, 2023

You don't need to do a full sync to get receipts for all transactions. Snap sync should suffice. Also you're doing an archive sync which is the slowest form of sync and needs 14Tb of storage :) you should really only do an archive sync if you need to do tracing of arbitrarily old transactions.

@chinaliuhan
Copy link
Author

chinaliuhan commented Jul 19, 2023

You don't need to do a full sync to get receipts for all transactions. Snap sync should suffice. Also you're doing an archive sync which is the slowest form of sync and needs 14Tb of storage :) you should really only do an archive sync if you need to do tracing of arbitrarily old transactions.

Thank you for the answer.

I need all the receipts, Is snap has all receipts?

What is the real difference between archive and full?

Which way should I try to switch to?

./geth --syncmode snap --gcmode archive --maxpeers 500 --cache 2000 .
or 
./geth --syncmode full --gcmode full --maxpeers 500 --cache 2000 .

@rjl493456442
Copy link
Member

I need all the receipts, Is snap has all receipts?

Yes

What is the real difference between archive and full?

archive sync will preserve all the past states, full sync won't have this guarantee(for all past states) but only the latest states.

Which way should I try to switch to?

./geth --syncmode snap

@chinaliuhan
Copy link
Author

chinaliuhan commented Jul 21, 2023

I tried snap and couldn't get all receipts.

Thanks again.

I tried snap and can't get all receipts, is my command wrong?

nohup ./geth --syncmode snap --port 31303 --maxpeers 200 --cache 2000  > snap.out&

I changed the --gcmode archive to --gcmode full, which is still very slow, the same as before, about 50 blocks per minute.

nohup ./geth --syncmode full --gcmode full --maxpeers 500 --cache 2000 

@s1na
Copy link
Contributor

s1na commented Jul 21, 2023

I tried snap and can't get all receipts,

Can you give us more info how you're trying to get receipts? If you're querying by transaction hash then you will also need to add --txlookuplimit 0 to your command.

@jsvisa
Copy link
Contributor

jsvisa commented Jul 21, 2023

I tried snap and can't get all receipts, is my command wrong?

You need to wait for all the historical data are fully synced, then you can read transactions and receipts. You can check by eth_blockNumber RPC to see it's synced or not

@chinaliuhan
Copy link
Author

chinaliuhan commented Jul 21, 2023

I tried snap and can't get all receipts,

Can you give us more info how you're trying to get receipts? If you're querying by transaction hash then you will also need to add --txlookuplimit 0 to your command.

Sorry , I use RPC.

syncing is done.
blockNumber is the latest block.

> eth.syncing
false
> eth.blockNumber
17741625
>

This is my curl request.
This transaction hash in block 5701009.

curl --location 'http://localhost:8645' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": [
        "0xbf229e0e912b9bb96fb73c8770213266b6c4b9c6edba6a7d49389c693e259d56"
    ],
    "id": 1
}'
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": null
}

@chinaliuhan
Copy link
Author

I tried snap and can't get all receipts, is my command wrong?

You need to wait for all the historical data are fully synced, then you can read transactions and receipts. You can check by eth_blockNumber RPC to see it's synced or not

Thanks, look like it's synced done.

eth.syncing
false
eth.blockNumber
17741625

@jsvisa
Copy link
Contributor

jsvisa commented Jul 21, 2023

yeah, the chain is synced, and as @s1na mentioned, you need to add --txlookuplimit=0 to regenerate the tx index

@chinaliuhan
Copy link
Author

yeah, the chain is synced, and as @s1na mentioned, you need to add --txlookuplimit=0 to regenerate the tx index

Thank you very much, I knew --txlookuplimit but didn't expect it to refer to receipts.
I'll try it now.

@jsvisa
Copy link
Contributor

jsvisa commented Jul 22, 2023

And after #27702 merged, you can direct query the block receipts, no need to query by transaction.

@chinaliuhan
Copy link
Author

chinaliuhan commented Jul 22, 2023

And after #27702 merged, you can direct query the block receipts, no need to query by transaction.

ok, thanks.

I am using geth-linux-amd64-1.12.0-e501b3b0.
Do I need to clone the code again and compile it?

@chinaliuhan
Copy link
Author

chinaliuhan commented Jul 22, 2023

yeah, the chain is synced, and as @s1na mentioned, you need to add --txlookuplimit=0 to regenerate the tx index

./geth --syncmode snap --txlookuplimit 0  --maxpeers 200 

I added --txlookuplimit 0 and restarted, and the index transaction seemed to complete, but still couldn't query the receipt. 
 Do I need to delete the database and resync it?

this is my curl request:

this transaction hash is in block 5701010.

curl --location 'http://localhost:8645' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": [
        "0xc89d2800987de4c084f51cc38c4d9d427d1047287244acb896befaadb246ce4d"
    ],
    "id": 1
}'

@chinaliuhan chinaliuhan changed the title geth full node is too slwo.Only about 50 blocks can be synchronized per minute geth full node is too slow.Only about 50 blocks can be synchronized per minute Jul 23, 2023
@chinaliuhan chinaliuhan changed the title geth full node is too slow.Only about 50 blocks can be synchronized per minute geth full node is too slow.Only about 50 blocks can be synchronized per minute. Jul 23, 2023
@s1na
Copy link
Contributor

s1na commented Aug 1, 2023

I added --txlookuplimit 0 and restarted, and the index transaction seemed to complete, but still couldn't query the receipt. 
 Do I need to delete the database and resync it?

Normally you shouldn't need to delete the database. By adding the --txlookuplimit flag it should generate the indices and store them in the database. Is this still an issue for you?

@chinaliuhan
Copy link
Author

I added --txlookuplimit 0 and restarted, and the index transaction seemed to complete, but still couldn't query the receipt. 
> Do I need to delete the database and resync it?

Normally you shouldn't need to delete the database. By adding the --txlookuplimit flag it should generate the indices and store them in the database. Is this still an issue for you?

Yes ,Still can't get a receipt.

@jsvisa
Copy link
Contributor

jsvisa commented Aug 2, 2023

@chinaliuhan you can't get all transaction receipts, or can't get some old transaction receipts? And can you get the recent transaction receipt? If possible, can you post your script to fetch the receipts?

@chinaliuhan
Copy link
Author

@chinaliuhan you can't get all transaction receipts, or can't get some old transaction receipts? And can you get the recent transaction receipt? If possible, can you post your script to fetch the receipts?

@jsvisa

I can't get some old transaction receipts. I can get the recent transaction receipt.

this is my curl request:

this transaction hash is in block 5701010.

curl --location 'http://localhost:8645' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": [
        "0xc89d2800987de4c084f51cc38c4d9d427d1047287244acb896befaadb246ce4d"
    ],
    "id": 1
}'

@jsvisa
Copy link
Contributor

jsvisa commented Aug 3, 2023

@chinaliuhan thanks for your reply, after you reset the --txlookuplimit=0, get will reindex the block transactions, so in geth logs you will see logs like below:

INFO [08-03|02:55:19.341] Indexing transactions                    blocks=2,050,113 txs=34,538,539 tail=3,377,741 total=5,427,854 elapsed=3m53.175s
INFO [08-03|02:55:27.344] Indexing transactions                    blocks=2,103,507 txs=34,624,458 tail=3,324,347 total=5,427,854 elapsed=4m1.177s
INFO [08-03|02:55:35.344] Indexing transactions                    blocks=2,175,881 txs=34,858,500 tail=3,251,973 total=5,427,854 elapsed=4m9.177s
INFO [08-03|02:55:43.352] Indexing transactions                    blocks=2,273,739 txs=35,084,752 tail=3,154,115 total=5,427,854 elapsed=4m17.186s
INFO [08-03|02:55:51.371] Indexing transactions                    blocks=2,307,341 txs=35,180,119 tail=3,120,513 total=5,427,854 elapsed=4m25.205s
INFO [08-03|02:55:59.371] Indexing transactions                    blocks=2,488,951 txs=35,496,628 tail=2,938,903 total=5,427,854 elapsed=4m33.205s
INFO [08-03|02:56:07.372] Indexing transactions                    blocks=2,632,193 txs=35,814,484 tail=2,795,661 total=5,427,854 elapsed=4m41.205s
INFO [08-03|02:56:15.377] Indexing transactions                    blocks=2,802,203 txs=36,078,429 tail=2,625,651 total=5,427,854 elapsed=4m49.211s
INFO [08-03|02:56:23.378] Indexing transactions                    blocks=2,939,031 txs=36,292,721 tail=2,488,823 total=5,427,854 elapsed=4m57.211s
INFO [08-03|02:56:31.380] Indexing transactions                    blocks=3,104,582 txs=36,544,441 tail=2,323,272 total=5,427,854 elapsed=5m5.214s
INFO [08-03|02:56:39.380] Indexing transactions                    blocks=3,231,184 txs=36,780,491 tail=2,196,670 total=5,427,854 elapsed=5m13.214s
INFO [08-03|02:56:47.381] Indexing transactions                    blocks=3,439,910 txs=37,146,277 tail=1,987,944 total=5,427,854 elapsed=5m21.214s
INFO [08-03|02:56:55.383] Indexing transactions                    blocks=3,590,505 txs=37,468,772 tail=1,837,349 total=5,427,854 elapsed=5m29.217s
INFO [08-03|02:57:03.383] Indexing transactions                    blocks=3,834,470 txs=37,809,346 tail=1,593,384 total=5,427,854 elapsed=5m37.217s
INFO [08-03|02:57:11.383] Indexing transactions                    blocks=4,312,300 txs=38,085,045 tail=1,115,554 total=5,427,854 elapsed=5m45.217s
INFO [08-03|02:57:19.384] Indexing transactions                    blocks=4,775,298 txs=38,332,732 tail=652,556   total=5,427,854 elapsed=5m53.218s

could you please have a look to see if the indexing process is done or not? (check with the below blocks=xxx)?

@chinaliuhan
Copy link
Author

@chinaliuhan thanks for your reply, after you reset the , get will reindex the block transactions, so in geth logs you will see logs like below:--txlookuplimit=0

INFO [08-03|02:55:19.341] Indexing transactions                    blocks=2,050,113 txs=34,538,539 tail=3,377,741 total=5,427,854 elapsed=3m53.175s
INFO [08-03|02:55:27.344] Indexing transactions                    blocks=2,103,507 txs=34,624,458 tail=3,324,347 total=5,427,854 elapsed=4m1.177s
INFO [08-03|02:55:35.344] Indexing transactions                    blocks=2,175,881 txs=34,858,500 tail=3,251,973 total=5,427,854 elapsed=4m9.177s
INFO [08-03|02:55:43.352] Indexing transactions                    blocks=2,273,739 txs=35,084,752 tail=3,154,115 total=5,427,854 elapsed=4m17.186s
INFO [08-03|02:55:51.371] Indexing transactions                    blocks=2,307,341 txs=35,180,119 tail=3,120,513 total=5,427,854 elapsed=4m25.205s
INFO [08-03|02:55:59.371] Indexing transactions                    blocks=2,488,951 txs=35,496,628 tail=2,938,903 total=5,427,854 elapsed=4m33.205s
INFO [08-03|02:56:07.372] Indexing transactions                    blocks=2,632,193 txs=35,814,484 tail=2,795,661 total=5,427,854 elapsed=4m41.205s
INFO [08-03|02:56:15.377] Indexing transactions                    blocks=2,802,203 txs=36,078,429 tail=2,625,651 total=5,427,854 elapsed=4m49.211s
INFO [08-03|02:56:23.378] Indexing transactions                    blocks=2,939,031 txs=36,292,721 tail=2,488,823 total=5,427,854 elapsed=4m57.211s
INFO [08-03|02:56:31.380] Indexing transactions                    blocks=3,104,582 txs=36,544,441 tail=2,323,272 total=5,427,854 elapsed=5m5.214s
INFO [08-03|02:56:39.380] Indexing transactions                    blocks=3,231,184 txs=36,780,491 tail=2,196,670 total=5,427,854 elapsed=5m13.214s
INFO [08-03|02:56:47.381] Indexing transactions                    blocks=3,439,910 txs=37,146,277 tail=1,987,944 total=5,427,854 elapsed=5m21.214s
INFO [08-03|02:56:55.383] Indexing transactions                    blocks=3,590,505 txs=37,468,772 tail=1,837,349 total=5,427,854 elapsed=5m29.217s
INFO [08-03|02:57:03.383] Indexing transactions                    blocks=3,834,470 txs=37,809,346 tail=1,593,384 total=5,427,854 elapsed=5m37.217s
INFO [08-03|02:57:11.383] Indexing transactions                    blocks=4,312,300 txs=38,085,045 tail=1,115,554 total=5,427,854 elapsed=5m45.217s
INFO [08-03|02:57:19.384] Indexing transactions                    blocks=4,775,298 txs=38,332,732 tail=652,556   total=5,427,854 elapsed=5m53.218s

could you please have a look to see if the indexing process is done or not? (check with the below )?blocks=xxx

Yes the Indexing transactions transaction seemed to complete.
Do I need to delete the database? geth removedb

@jsvisa
Copy link
Contributor

jsvisa commented Aug 3, 2023

Do I need to delete the database? geth removed

No you don't need to, if you removed them, then need to resync

@s1na
Copy link
Contributor

s1na commented Aug 3, 2023

Is there anything in the logs when you make that request and it fails? Can you get receipts from other old blocks let's say 6m 7m or sth? Also can you try getting the same block and the transaction seeing if they work as expected?

@chinaliuhan
Copy link
Author

Do I need to delete the database? geth removed

No you don't need to, if you removed them, then need to resync

it worked, thanks.

@chinaliuhan
Copy link
Author

Is there anything in the logs when you make that request and it fails? Can you get receipts from other old blocks let's say 6m 7m or sth? Also can you try getting the same block and the transaction seeing if they work as expected?

it worked, thanks.

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

No branches or pull requests

4 participants