-
Notifications
You must be signed in to change notification settings - Fork 747
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
Optimise no-op PATCH ops in VC HTTP API #5064
Conversation
When spamming requests,
Spam script is something like: #!/usr/bin/env bash
while [ true ]
do
curl -s -X PATCH --data '{"builder_proposals": false}' -H "Content-Type: application/json" -H "Authorization: Bearer api-token-0x02430fd0af4a262df8be03e2f2fad494162d1d22488720fc8254639d7371b2ff7b" "http://localhost:5062/lighthouse/validators/0x90e3b075e5261c4ba40e0d33480ae16251f9383e30e1b541bd8ddfb3b04a5e64965fb5d3cabc7ff9bf52a2b028c3b9a5"
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me and I see no reason not to do it, but I also agree that some kind of map seems like a natural solution for the long term (although I'm not sure about the implications of such a change).
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 88b37a1 |
* Optimise no-op changes in VC API * Handle another no-op case * Merge remote-tracking branch 'origin/unstable' into opt-vc-patch-api
Issue Addressed
Closes #4936
Proposed Changes
Optimise
PATCH /lighthouse/validators/{validator_pubkey}
so that it is faster when processing redundant changes. I suspect this will help VCs running thousands of keys from becoming overwhelmed when processing lots of these API queries.Longer-term we should still think about optimising the key cache and API more for actual changes. I suspect the
O(n)
loop over the validators for each request is part of the problem, here:lighthouse/validator_client/src/initialized_validators.rs
Line 782 in 441fc16
Addressing this by using a persistent map would both make the API faster, and help to resolve atomicity issues like #4984.