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

add rangelimit option #24508

Open
cipig opened this issue Mar 7, 2022 · 4 comments
Open

add rangelimit option #24508

cipig opened this issue Mar 7, 2022 · 4 comments

Comments

@cipig
Copy link

cipig commented Mar 7, 2022

eth_getLogs is causing huge load on the RPC node, using most of the CPU cores

i guess this are the corresponding log entries:

Mar 07 05:27:55 electrum1 geth.eth[37875]: WARN [03-07|05:27:55.984] Served eth_getLogs                       conn=70.98.100.xxx:46376   reqid=6      duration=2m26.41494259s  err="context canceled"
Mar 07 05:27:55 electrum1 geth.eth[37875]: WARN [03-07|05:27:55.992] Served eth_getLogs                       conn=70.98.100.xxx:45080   reqid=6      duration=2m58.883381419s err="context canceled"
Mar 07 05:27:56 electrum1 geth.eth[37875]: WARN [03-07|05:27:56.000] Served eth_getLogs                       conn=70.98.100.xxx:45082   reqid=6      duration=2m58.898682623s err="context canceled"
Mar 07 05:27:56 electrum1 geth.eth[37875]: WARN [03-07|05:27:56.004] Served eth_getLogs                       conn=70.98.100.xxx:46380   reqid=6      duration=2m26.313996603s err="context canceled"

duration > 2 minutes

can the --rangelimit option be added to geth, like it was done in bsc repo?
this is the PR: bnb-chain/bsc#101

@rjl493456442
Copy link
Member

You can use the following parameters to specify the chain range.

fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.

However, if you want to limit the requests in the server side for protection(for example there are spam requests over the internet to slow down your node), I think you should add rpc endpoint restrictions.

@cipig
Copy link
Author

cipig commented Mar 8, 2022

Yes, i need to restrict this on server side, since it's a public RPC server. What do you mean with rpc endpoint restrictions? I couldn't find any params that i could use to restrict anything (eg the number of cores the server is allowed to use).

@s1na
Copy link
Contributor

s1na commented Mar 9, 2022

I'll bring this up for discussion but I feel like it can be easily handled via a proxy/load-balancer in front of geth.

@holiman
Copy link
Contributor

holiman commented Mar 10, 2022

Triage discussion: If someone converts the bsc PR to geth, and renamees it to rpc.rangelimit, we'd most likely accept that.

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

Successfully merging a pull request may close this issue.

7 participants
@ligi @holiman @s1na @rjl493456442 @cipig and others