Skip to content
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

chore: speed up check-features #481

Merged
merged 4 commits into from
Feb 10, 2025
Merged

Conversation

tobz
Copy link
Member

@tobz tobz commented Feb 6, 2025

Summary

The check-features Make target, and subsequently the CI job for it, is slow. Takes roughly 6-7 minutes on a clean build. This isn't great.

A lot of this is because we use a lot of dependencies, which is hard to get around... but a significant chunk -- around 30% -- is actually because we're doing cargo check on crates with no features... which is wasted time and effort.

This PR simply scopes cargo hack check directly to the crates with features that need to be checked, since the rest of the crates not being checked will be checked elsewhere: during unit tests, when the binaries they generate are used, and so on.

When testing locally, a clean run of check-features took 6m20s on my machine before this PR. After the PR, it takes around 4m20s... which is around 32% faster overall.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

N/A

References

N/A

@tobz tobz requested a review from a team as a code owner February 6, 2025 21:04
@tobz tobz added the type/chore Updates to dependencies or general "administrative" tasks necessary to maintain the codebase/repo. label Feb 6, 2025
Makefile Outdated
@@ -382,7 +382,7 @@ check-licenses: ## Check that the third-party license file is up to date
check-features: check-rust-build-tools cargo-install-cargo-hack
check-features: ## Check that ADP builds with all possible combinations of feature flags
@echo "[*] Checking feature flag compatibility matrix..."
@cargo hack check --feature-powerset --tests --quiet
@cargo hack --feature-powerset -p agent-data-plane -p ddsketch-agent -p saluki-app -p saluki-metrics -p stringtheory -p saluki-tls check --tests --quiet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you think about inverting this and using --exclude instead? That would reduce the risk that we add a new package that has features and forget to include it here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, this seems to list all packages with features:

$ find . -name Cargo.toml | grep -v '^./Cargo.toml' | xargs -I{} bash -c 'if [[ $(cargo read-manifest --manifest-path {} | jq ".features|del(.default)|length > 0") == "true" ]] ; then echo {} ; fi'
./bin/agent-data-plane/Cargo.toml
./lib/ddsketch-agent/Cargo.toml
./lib/saluki-app/Cargo.toml
./lib/stringtheory/Cargo.toml
./lib/saluki-metrics/Cargo.toml
./lib/saluki-tls/Cargo.toml

So you could use that to build the list to test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with --exclude.

It's funny... I just went to test this out again because I was about to write "I tried this and for some reason it didn't seem to work"... but then I just tried it again, and it seems to work. 🤷🏻

I like the idea of automatically grabbing all packages with features rather than having to update the list, but it gets a little dicey trying to do more complex logic in Make targets, especially cross-platform... so I think I'll just go with --exclude for now because at least then there's no risk of missing things with features.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, turns out that after typing out the 10th exclude... it was too much for me to stomach and I ended up going with your idea of querying for the crates with features. 😂

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least it is future proof now :)

@pr-commenter
Copy link

pr-commenter bot commented Feb 6, 2025

Regression Detector (DogStatsD)

Regression Detector Results

Run ID: 845ba64e-1fe1-4709-961b-2b0599f232ec

Baseline: 7.63.0-rc.2
Comparison: 7.63.0-rc.2

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_100mb_3k_contexts_distributions_only memory utilization +0.30 [+0.13, +0.46] 1
dsd_uds_10mb_3k_contexts ingress throughput +0.00 [-0.00, +0.01] 1
dsd_uds_512kb_3k_contexts ingress throughput +0.00 [-0.01, +0.01] 1
dsd_uds_100mb_250k_contexts ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_50k_contexts ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_3k_contexts_dualship ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_50k_contexts_memlimit ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_3k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_40mb_12k_contexts_40_senders ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_100mb_3k_contexts ingress throughput -0.00 [-0.04, +0.04] 1
quality_gates_idle_rss memory utilization -1.08 [-1.15, -1.00] 1
dsd_uds_500mb_3k_contexts ingress throughput -2.37 [-2.46, -2.28] 1

Bounds Checks: ❌ Failed

perf experiment bounds_check_name replicates_passed links
quality_gates_idle_rss memory_usage 0/10

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@pr-commenter
Copy link

pr-commenter bot commented Feb 6, 2025

Regression Detector (Saluki)

Regression Detector Results

Run ID: b853c959-4ba9-487f-a55e-3a7b2906282c

Baseline: b8af303
Comparison: daa0905
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_1mb_50k_contexts_memlimit ingress throughput +0.90 [+0.62, +1.17] 1
dsd_uds_100mb_250k_contexts ingress throughput +0.01 [-0.03, +0.05] 1
dsd_uds_50mb_10k_contexts_no_inlining ingress throughput +0.01 [-0.06, +0.07] 1
dsd_uds_1mb_3k_contexts_dualship ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_512kb_3k_contexts ingress throughput +0.00 [-0.01, +0.01] 1
dsd_uds_1mb_50k_contexts ingress throughput -0.00 [-0.02, +0.02] 1
dsd_uds_1mb_3k_contexts ingress throughput -0.00 [-0.01, +0.01] 1
dsd_uds_100mb_3k_contexts ingress throughput -0.00 [-0.04, +0.04] 1
dsd_uds_40mb_12k_contexts_40_senders ingress throughput -0.01 [-0.03, +0.02] 1
dsd_uds_50mb_10k_contexts_no_inlining_no_allocs ingress throughput -0.01 [-0.06, +0.05] 1
dsd_uds_10mb_3k_contexts ingress throughput -0.02 [-0.05, +0.01] 1
quality_gates_idle_rss memory utilization -0.16 [-0.19, -0.13] 1
dsd_uds_100mb_3k_contexts_distributions_only memory utilization -0.40 [-0.50, -0.29] 1
dsd_uds_500mb_3k_contexts ingress throughput -0.96 [-1.08, -0.84] 1

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
quality_gates_idle_rss memory_usage 10/10

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@pr-commenter
Copy link

pr-commenter bot commented Feb 6, 2025

Regression Detector Links

Experiment Result Links

experiment link(s)
dsd_uds_100mb_250k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_100mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_100mb_3k_contexts_distributions_only [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_10mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_3k_contexts_dualship [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_50k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_50k_contexts_memlimit [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_40mb_12k_contexts_40_senders [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_500mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_512kb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
quality_gates_idle_rss [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_50mb_10k_contexts_no_inlining (ADP only) [Profiling (ADP)] [SMP Dashboard]
dsd_uds_50mb_10k_contexts_no_inlining_no_allocs (ADP only) [Profiling (ADP)] [SMP Dashboard]

jszwedko
jszwedko previously approved these changes Feb 7, 2025
@tobz tobz force-pushed the tobz/improve-check-features-ci-job branch from c4bde5d to daa0905 Compare February 10, 2025 14:32
@github-actions github-actions bot added the area/ci CI/CD, automated testing, etc. label Feb 10, 2025
@tobz tobz merged commit 535a88b into main Feb 10, 2025
19 of 21 checks passed
@tobz tobz deleted the tobz/improve-check-features-ci-job branch February 10, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci CI/CD, automated testing, etc. type/chore Updates to dependencies or general "administrative" tasks necessary to maintain the codebase/repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants