open-nomad/command/agent
Tim Gross 37134a4a37
eval delete: move batching of deletes into RPC handler and state (#15117)
During unusual outage recovery scenarios on large clusters, a backlog of
millions of evaluations 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, re-serialize 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.
2022-11-14 14:08:13 -05:00
..
consul deps: bump shoenig for str func bugfixes (#14974) 2022-10-20 08:11:43 -05:00
event
host testing: setting env var incompatible with parallel tests (#14405) 2022-08-30 14:49:03 -04:00
monitor
pprof
test-resources
testdata acl: correctly resolve ACL roles within client cache. (#14922) 2022-10-20 09:37:32 +02:00
acl_endpoint.go api: provide more detail on ACL bootstrap request error (#14629) 2022-09-20 21:20:04 -04:00
acl_endpoint_test.go
agent.go server: add git revision to serf tags (#9159) 2022-11-07 10:34:33 -05:00
agent_endpoint.go
agent_endpoint_test.go
agent_oss.go
agent_test.go
alloc_endpoint.go client: fix RPC forwarding when querying checks for alloc. (#14498) 2022-09-08 16:55:23 +02:00
alloc_endpoint_test.go
bindata_assetfs.go Generate files for 1.4.2 release 2022-10-27 13:08:05 -04:00
command.go
command_test.go
config.go acl: correctly resolve ACL roles within client cache. (#14922) 2022-10-20 09:37:32 +02:00
config_oss.go
config_parse.go acl: correctly resolve ACL roles within client cache. (#14922) 2022-10-20 09:37:32 +02:00
config_parse_test.go acl: correctly resolve ACL roles within client cache. (#14922) 2022-10-20 09:37:32 +02:00
config_test.go acl: correctly resolve ACL roles within client cache. (#14922) 2022-10-20 09:37:32 +02:00
csi_endpoint.go
csi_endpoint_test.go
deployment_endpoint.go
deployment_endpoint_test.go
eval_endpoint.go eval delete: move batching of deletes into RPC handler and state (#15117) 2022-11-14 14:08:13 -05:00
eval_endpoint_test.go eval delete: move batching of deletes into RPC handler and state (#15117) 2022-11-14 14:08:13 -05:00
event_endpoint.go
event_endpoint_test.go api: remove mapstructure tags fromPort struct (#12916) 2022-11-08 11:26:28 +01:00
fs_endpoint.go
fs_endpoint_test.go
helpers.go
helpers_test.go
http.go API for Eval.Count (#15147) 2022-11-07 08:53:19 -05:00
http_oss.go
http_stdlog.go
http_stdlog_test.go
http_test.go
job_endpoint.go template: error on missing key (#15141) 2022-11-04 13:23:01 -04:00
job_endpoint_test.go template: error on missing key (#15141) 2022-11-04 13:23:01 -04:00
keyring.go
keyring_endpoint.go remove root keyring install API (#14514) 2022-09-09 08:50:35 -04:00
keyring_endpoint_test.go remove root keyring install API (#14514) 2022-09-09 08:50:35 -04:00
keyring_test.go
log_file.go
log_file_bsd.go
log_file_linux.go
log_file_test.go
log_file_windows.go
log_levels.go
log_levels_test.go
metrics_endpoint.go
metrics_endpoint_test.go
namespace_endpoint.go
namespace_endpoint_test.go
node_endpoint.go
node_endpoint_test.go
operator_endpoint.go migrate autopilot implementation to raft-autopilot (#14441) 2022-09-01 14:27:10 -04:00
operator_endpoint_oss.go
operator_endpoint_test.go
plugins.go
region_endpoint.go
region_endpoint_test.go
retry_join.go
retry_join_test.go
scaling_endpoint.go
scaling_endpoint_test.go
search_endpoint.go
search_endpoint_test.go
service_registration_endpoint.go
service_registration_endpoint_test.go
stats_endpoint.go
stats_endpoint_test.go
status_endpoint.go
status_endpoint_test.go
stub_asset.go
syslog.go
syslog_test.go
system_endpoint.go
system_endpoint_test.go
testagent.go
testagent_oss.go
testingutils_test.go api: remove mapstructure tags fromPort struct (#12916) 2022-11-08 11:26:28 +01:00
variable_endpoint.go
variable_endpoint_test.go cleanup: rename Equals to Equal for consistency (#14759) 2022-10-10 09:28:46 -05:00