-
Notifications
You must be signed in to change notification settings - Fork 206
test(benchmark): add cloud benchmark suites and CloudMode fixes for running them #3644
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
Open
kmatasfp
wants to merge
2
commits into
main
Choose a base branch
from
port/benchmark-suites
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -484,13 +484,106 @@ impl Display for BenchmarkResultView { | |
| } | ||
| } | ||
|
|
||
| /// Cloud-mode run metadata collected by the buildspec and passed via environment variables. | ||
| /// All fields are optional — missing env vars produce `None` rather than failing the run. | ||
| #[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct RunMetadata { | ||
| /// The `golem-oss` commit SHA that was built and deployed. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub golem_oss_commit_sha: Option<String>, | ||
| /// The `golem-cloud` (kubernetes manifests) commit SHA that was deployed. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub kubernetes_manifest_commit_sha: Option<String>, | ||
| /// Number of Ready `worker-executor` pods observed at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub observed_cluster_size: Option<u32>, | ||
| /// Container image tag of the deployed `worker-executor`. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub worker_executor_image_tag: Option<String>, | ||
| /// Container image tag of the deployed `registry-service`. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub registry_service_image_tag: Option<String>, | ||
| /// Container image tag of the deployed `worker-service`. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub worker_service_image_tag: Option<String>, | ||
| /// Aurora ACU capacity for the main (`golem_dev`) cluster at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub aurora_acu_main: Option<f64>, | ||
| /// Aurora ACU capacity for the indexed-storage cluster at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub aurora_acu_indexed: Option<f64>, | ||
| /// Aurora ACU capacity for the keyvalue-storage cluster at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub aurora_acu_keyvalue: Option<f64>, | ||
| /// Ready replica count for `worker-executor` at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub worker_executor_replicas: Option<u32>, | ||
| /// Ready replica count for `worker-service` at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub worker_service_replicas: Option<u32>, | ||
| /// Ready replica count for `registry-service` at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub registry_service_replicas: Option<u32>, | ||
| /// Ready replica count for `compilation-service` at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub compilation_service_replicas: Option<u32>, | ||
| /// Ready replica count for `debugging-service` at run start. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub debugging_service_replicas: Option<u32>, | ||
| /// Free-form note from the `workflow_dispatch` trigger. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub note: Option<String>, | ||
| } | ||
|
|
||
| impl RunMetadata { | ||
| /// Reads all `GOLEM_BENCH_*` environment variables and returns a populated | ||
| /// `RunMetadata`. Missing variables produce `None` for that field. | ||
| pub fn from_env() -> Self { | ||
| fn env_str(key: &str) -> Option<String> { | ||
| std::env::var(key).ok().filter(|v| !v.is_empty()) | ||
| } | ||
| fn env_u32(key: &str) -> Option<u32> { | ||
| env_str(key).and_then(|v| v.parse().ok()) | ||
| } | ||
| fn env_f64(key: &str) -> Option<f64> { | ||
| env_str(key).and_then(|v| v.parse().ok()) | ||
| } | ||
|
|
||
| Self { | ||
| golem_oss_commit_sha: env_str("GOLEM_BENCH_OSS_COMMIT_SHA"), | ||
| kubernetes_manifest_commit_sha: env_str("GOLEM_BENCH_K8S_MANIFEST_COMMIT_SHA"), | ||
| observed_cluster_size: env_u32("GOLEM_BENCH_OBSERVED_CLUSTER_SIZE"), | ||
| worker_executor_image_tag: env_str("GOLEM_BENCH_WORKER_EXECUTOR_IMAGE_TAG"), | ||
| registry_service_image_tag: env_str("GOLEM_BENCH_REGISTRY_SERVICE_IMAGE_TAG"), | ||
| worker_service_image_tag: env_str("GOLEM_BENCH_WORKER_SERVICE_IMAGE_TAG"), | ||
| aurora_acu_main: env_f64("GOLEM_BENCH_AURORA_ACU_MAIN"), | ||
| aurora_acu_indexed: env_f64("GOLEM_BENCH_AURORA_ACU_INDEXED"), | ||
| aurora_acu_keyvalue: env_f64("GOLEM_BENCH_AURORA_ACU_KEYVALUE"), | ||
| worker_executor_replicas: env_u32("GOLEM_BENCH_WORKER_EXECUTOR_REPLICAS"), | ||
| worker_service_replicas: env_u32("GOLEM_BENCH_WORKER_SERVICE_REPLICAS"), | ||
| registry_service_replicas: env_u32("GOLEM_BENCH_REGISTRY_SERVICE_REPLICAS"), | ||
| compilation_service_replicas: env_u32("GOLEM_BENCH_COMPILATION_SERVICE_REPLICAS"), | ||
| debugging_service_replicas: env_u32("GOLEM_BENCH_DEBUGGING_SERVICE_REPLICAS"), | ||
| note: env_str("GOLEM_BENCH_RUN_NOTE"), | ||
| } | ||
| } | ||
|
|
||
| /// Returns `true` if every field is `None` (nothing was read from env). | ||
| pub fn is_empty(&self) -> bool { | ||
| self == &Self::default() | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
| pub struct BenchmarkSuiteResultCollection { | ||
| pub runs: Vec<BenchmarkSuiteResult>, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
| pub struct BenchmarkSuiteResult { | ||
| /// Result format version. Always `1` for results produced by this binary. | ||
| pub schema_version: u32, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a default, because on the daily CI benchmark run we append results to an old result file (that is rendered at https://golemcloud.github.io/benchmark-results/) |
||
| pub suite: String, | ||
| pub environment: String, | ||
| pub version: String, | ||
|
|
@@ -499,6 +592,10 @@ pub struct BenchmarkSuiteResult { | |
| /// cross-run correlation and garbage collection of orphaned state. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub run_id: Option<String>, | ||
| /// Cloud-mode run metadata populated from `GOLEM_BENCH_*` environment variables. | ||
| /// `None` in Spawned or Provided modes where cluster metadata is not available. | ||
| #[serde(skip_serializing_if = "Option::is_none", default)] | ||
| pub run_metadata: Option<RunMetadata>, | ||
| pub results: Vec<BenchmarkResult>, | ||
| } | ||
|
|
||
|
|
@@ -530,11 +627,13 @@ impl BenchmarkSuiteResult { | |
| ); | ||
|
|
||
| Self { | ||
| schema_version: 1, | ||
| suite: suite.to_string(), | ||
| environment, | ||
| version: golem_common::golem_version().to_string(), | ||
| timestamp: Utc::now(), | ||
| run_id: None, | ||
| run_metadata: None, | ||
| results: vec![], | ||
| } | ||
| } | ||
|
|
||
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
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
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
68 changes: 68 additions & 0 deletions
68
integration-tests/benchmark_suites/cloud-density-saturation.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Cloud throughput-saturation benchmark suite. | ||
| # | ||
| # Unlike cloud-perf's throughput benchmarks (which keep `size` small enough that | ||
| # all workers fit in memory), this suite deliberately ramps the number of | ||
| # active, memory-holding agents up to and past the executor's memory ceiling to | ||
| # find the per-pod active-agent capacity and the throughput sustained once | ||
| # memory is exhausted. | ||
| # | ||
| # Each agent retains a deterministic, per-agent-distinct amount of resident | ||
| # memory, so the fleet presents a mix of footprints near the limit (exercising | ||
| # the admission/eviction path). The measured phase drives one in-flight | ||
| # `busy_for` call per agent and records aggregate throughput. | ||
| # | ||
| # Run with the benchmarks binary's `cloud` subcommand (same flags as cloud-perf): | ||
| # | ||
| # benchmarks suite integration-tests/benchmark_suites/cloud-density-saturation.yaml \ | ||
| # --save-to-json result.json \ | ||
| # cloud --api-url https://<host> --apps-base-domain <domain> \ | ||
| # --admin-account-token <token> --builtin-plugin-owner-account-id <uuid> \ | ||
| # --default-plan-id <uuid> --component-directory <path-to-wasm-components> | ||
| # | ||
| # Reading the result: plot `saturation-throughput-ops-per-sec` and | ||
| # invocation-retries/timeouts against `size`. Throughput climbs with `size` | ||
| # until the pod's memory is exhausted, then plateaus or drops while retries and | ||
| # eviction churn rise — that knee is the active-agent ceiling. | ||
| # | ||
| # `clusterSize` is ignored in cloud mode (single observed cluster). | ||
|
|
||
| name: cloud-density-saturation | ||
| benchmarks: | ||
| # # Rust echo agents — lean per-instance linear memory (the ~900 KB module is | ||
| # # charged once per component, shared across all agents; what scales per agent | ||
| # # is the small instance heap). The previous run reached the top of the sweep | ||
| # # (12000) without saturating pod memory, so the knee here is throughput / | ||
| # # eviction-churn rather than memory. Dropped the low points that told us | ||
| # # nothing and pushed the range up with coarser steps. | ||
| # - name: throughput-saturation-echo-rust | ||
| # iterations: 3 | ||
| # clusterSize: [2] | ||
| # size: [2000, 3000, 4000, 5000, 10000, 15000, 20000] | ||
| # length: [0] | ||
|
|
||
| # # TypeScript echo agents — each instance instantiates its own QuickJS runtime | ||
| # # and JS heap in its own linear memory (the 17.4 MB module is shared once per | ||
| # # component; the per-instance runtime state is the heavy per-agent cost). | ||
| # # Heavier per agent than the Rust variant, so a lower knee — but the previous | ||
| # # run reached 2000 without saturating, so push higher and drop the low points. | ||
| # - name: throughput-saturation-echo-ts | ||
| # iterations: 3 | ||
| # clusterSize: [2] | ||
| # size: [1000, 2000, 3000] | ||
| # length: [0] | ||
|
|
||
| # Synthetic footprint — each agent retains a deterministic per-agent-distinct | ||
| # amount of resident memory, exercising the admission/eviction path with a | ||
| # controllable footprint near the limit. Run first: this is the variant that | ||
| # actually fills memory and drives the gate to its reject/evict path. | ||
| # size = number of active, memory-holding agents (the ramp axis) | ||
| # length = base per-agent memory footprint in bytes; each agent retains a | ||
| # deterministic multiple (1x..8x), averaging ~4.5x. 16 MiB base => | ||
| # ~72 MiB average per agent, filling a ~10 GiB usable pool around | ||
| # ~145 agents. The sweep brackets that ceiling and pushes well past it | ||
| # so the admission gate's reject/evict behaviour near OOM is exercised. | ||
| - name: throughput-saturation-counters | ||
| iterations: 1 | ||
| clusterSize: [2] | ||
| size: [50, 100, 150, 200, 300] | ||
| length: [16777216] |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I would panic if the env var is set but not a number, to avoid confusion