-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
eval delete: move batching of deletes into RPC handler and state #15117
Merged
Commits on Nov 7, 2022
-
eval delete: move batching of deletes into RPC handler and state
During unusual outage recovery scenarios on large clusters, a backlog of millions of evaluatons can appear. In these cases, the `eval delete` command can put excessive load on the cluster by listing large sets of evals to extract the IDs and then sending larges batches of IDs. Although the command's batch size was carefully tuned, we still need to be JSON deserialize, reserialize to messagepack, send the log entries through raft, and get the FSM applied. To improve performance of this recovery case, move the batching process into the RPC handler and the state store. The design here is a little weird, so let's look a the failed options first: * A naive solution here would be to just send the filter as the raft request and let the FSM apply delete the whole set in a single operation. Benchmarking with 1M evals on a 3 node cluster demonstrated this can block the FSM apply for several minutes, which puts the cluster at risk if there's a leadership failover (the barrier write can't be made while this apply is in-flight). * A less naive but still bad solution would be to have the RPC handler filter and paginate, and then hand a list of IDs to the existing raft log entry. Benchmarks showed this blocked the FSM apply for 20-30s at a time and took roughly an hour to complete. Instead, we're filtering and paginating in the RPC handler to find a page token, and then passing both the filter and page token in the raft log. The FSM apply recreates the paginator using the filter and page token to get roughly the same page of evaluations, which it then deletes. The pagination process is fairly cheap (only abut 5% of the total FSM apply time), so counter-intuitively this rework ends up being much faster. A benchmark of 1M evaluations showed this blocked the FSM apply for 20-30ms at a time (typical for normal operations) and completes in less than 4 minutes. Note that, as with the existing design, this delete is not consistent: a new evaluation inserted "behind" the cursor of the pagination will fail to be deleted.
Configuration menu - View commit details
-
Copy full SHA for 285d39f - Browse repository at this point
Copy the full SHA 285d39fView commit details
Commits on Nov 9, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 58e426b - Browse repository at this point
Copy the full SHA 58e426bView commit details -
Configuration menu - View commit details
-
Copy full SHA for d71c26e - Browse repository at this point
Copy the full SHA d71c26eView commit details
Commits on Nov 14, 2022
-
Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
Configuration menu - View commit details
-
Copy full SHA for a93dbf4 - Browse repository at this point
Copy the full SHA a93dbf4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 12cb7ca - Browse repository at this point
Copy the full SHA 12cb7caView commit details -
Configuration menu - View commit details
-
Copy full SHA for aa7239a - Browse repository at this point
Copy the full SHA aa7239aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b71440a - Browse repository at this point
Copy the full SHA b71440aView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.