benchmarking/locust: record cluster hardware facts and density frontiers - #1723
Open
Nishanth Kotla (Nishanth29) wants to merge 2 commits into
Open
Nishanth Kotla (Nishanth29) wants to merge 2 commits into
Nishanth Kotla (Nishanth29) wants to merge 2 commits into
Conversation
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #1590
First of two PRs. This one covers Kubernetes-side hardware discovery; the follow-up adds the Prometheus harvest.
What this PR does
The locust runner records no information about the hardware it runs on, so trial results cannot be normalized across machine types or node counts. This adds cluster capacity discovery and derives actor density frontiers from it, persisting both the raw readings and the derived ratios to
stats.jsonl.Proposed Changes
Cluster hardware discovery
New module
benchmarking/locust/cluster_facts.py, kept separate fromrunner.py. It reads node count, machine type, allocatable cores and allocatable RAM, and the worker pod count via the official Kubernetes Python client, which resolves in-cluster and local kubeconfig auth without a kubectl subprocess.Node and pod listing is proportional to cluster size, so
--no-cluster-factsdisables discovery. Discovery is best effort in either case: an unreachable API server or missing RBAC leaves the facts null and does not fail the run.No value is defaulted or inferred. Unmeasured fields are
null; a measured zero is0. The two remain distinguishable to any consumer.Density frontiers
Added to the
trial_summaryrow instats.jsonl:actors_per_nodeactors_per_vcpuactors_per_gb_ramactors_per_pod_p50/_p90/_p99aggregate_failure_ratio<operation>_failure_ratiodur_dir_write_failure_ratioActors per pod is reported as a distribution across the run's time samples (
p50/p90/p99) rather than one average, because ramp-up and custom load shapes have no single user count to call steady.The raw readings (
machine_type,node_count,allocatable_cores,allocatable_ram_gb,worker_pod_count) are written alongside the derived ratios so they can be re-derived without re-running the trial.RBAC
Nodes are cluster scoped and require a ClusterRole with
listonnodes. Pods require only a namespaced Role withlistinbenchmark-workloads.locust.yamlandrunner-job.yaml.tmpleach define their own separately named pair.Note that
locust.yamlnow binds a Role inbenchmark-workloads, so that namespace must exist before the manifest is applied.benchmarking/workloads/deploy.shcreates it.status.jsonis unchanged.How this was tested
11 unit tests in
test_cluster_facts.pycovering percentile boundaries, capacity scoped to only the nodes running worker pods, zero worker pods treated as a valid reading, unreadable facts returning null, and flag behavior.Verified against a live GKE cluster. Discovery returned
c3d-standard-8, 1 node, 7.91 allocatable cores, 27.73 GB, 5 worker pods, all matchingkubectl. The emitted frontiers were re-derived by hand fromstats_history.csvand matched.--no-cluster-factsreturns all nulls.Both manifests pass
kubectl apply --dry-run=client, with no cluster-scoped name collisions between them.References
Agent Substrate: Actor Density Benchmark Specs