-
Notifications
You must be signed in to change notification settings - Fork 808
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
Delayed RPC Send Using Tokens #5923
base: unstable
Are you sure you want to change the base?
Conversation
29e3f00
to
90361d6
Compare
90361d6
to
7e0c630
Compare
# Conflicts: # beacon_node/lighthouse_network/src/rpc/handler.rs
…me protocol per peer
# Conflicts: # beacon_node/lighthouse_network/tests/rpc_tests.rs
# Conflicts: # beacon_node/lighthouse_network/tests/rpc_tests.rs
fe458ac
to
2d7a679
Compare
aa57e8b
to
b73a336
Compare
https://github.com/sigp/lighthouse/actions/runs/12109786536/job/33759312718?pr=5923 The |
This is ready for another review. 🙏 I have added a concurrency limit on the self-lmiter. Now, the self-limiter limits outbound requests based on both the number of concurrent requests and tokens (optional). Whether we also need to limit tokens in the self-limiter is still under duscussion. Let me know if you have any ideas. (FYI) I also ran lighthouse (this branch) on the testnet for ~24hours. During this time, the LH node responded with 21 RateLimited errors due to the number of active requests. These errors appear in the logs like the example below. Note that this is about inbound requests, not the self-limiter (outbound requests).
|
# Conflicts: # beacon_node/lighthouse_network/src/rpc/mod.rs # beacon_node/lighthouse_network/src/rpc/self_limiter.rs
@pawanjay176 @jxs @dapplion @jimmygchen - If anyone has any spare time, I think this is a good one to get in. |
I removed |
Issue Addressed
closes #5785
Proposed Changes
The diagram below shows the differences in how the receiver (responder) behaves before and after this PR. The following sentences will detail the changes.
Is there already an active request with the same protocol?
This check is not performed in
Before
. This is taken from the PR in the consensus-spec, which proposes updates regarding rate limiting and response timeout.https://github.com/ethereum/consensus-specs/pull/3767/files
The PR mentions the requester side. In this PR, I introduced the
ActiveRequestsLimiter
for theresponder
side to restrict more than two requests from running simultaneously on the same protocol per peer. If the limiter disallows a request, the responder sends a rate-limited error and penalizes the requester.Rate limit reached?
andWait until tokens are regenerated
UPDATE: I moved the limiter logic to the behaviour side. #5923 (comment)
The rate limiter is shared between the behaviour and the handler. (Arc<Mutex<RateLimiter>>>
) The handler checks the rate limit and queues the response if the limit is reached. The behaviour handles pruning.I considered not sharing the rate limiter between the behaviour and the handler, and performing all of these either within the behaviour or handler. However, I decided against this for the following reasons:Regarding performing everything within the behaviour: The behaviour is unable to recognize the response protocol whenRPC::send_response()
is called, especially when the response isRPCCodedResponse::Error
. Therefore, the behaviour can't rate limit responses based on the response protocol.Regarding performing everything within the handler: When multiple connections are established with a peer, there could be multiple handlers interacting with that peer. Thus, we cannot enforce rate limiting per peer solely within the handler. (Any ideas? 🤔 )Additional Info
Naming
I have renamed the fields of the behaviour to make them more intuitive:
Testing
I have run beacon node with this changes for 24hours, it looks work fine.
The rate-limited error has not occurred anymore while running this branch.