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

enhancement: incorporate origin key into context key hash to shrink size of ContextKey #428

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tobz
Copy link
Member

@tobz tobz commented Jan 17, 2025

Context

In #415, we made a number of changes related to origin enrichment, one of which involved bundling the "origin" key -- a spiritual equivalent to ContextKey, but for origin data -- into ContextKey itself.

This had the side effect of changing the size of ContextKey from 8 bytes (u64) to 24 bytes (u64 + Option<OriginKey>, where OriginKey was just a u64). As ContextKey is the key type for our actual context cache in ContextResolver, this means we're spending more memory for every cached context.

Solution

We've slightly reworked how we generate, and pass around, the OriginKey during context resolving. We've also folded in the hash of the origin key to the context's hash itself, rather than carrying the origin key as a separate field. This brings ContextKey back down to 8 bytes.

@tobz tobz added the type/enhancement An enhancement in functionality or support. label Jan 17, 2025
@tobz tobz requested review from a team as code owners January 17, 2025 16:59
@github-actions github-actions bot added the area/core Core functionality, event model, etc. label Jan 17, 2025
@tobz tobz force-pushed the tobz/shrink-context-key-size branch from f9b0aed to ee396d5 Compare January 17, 2025 16:59
@pr-commenter
Copy link

pr-commenter bot commented Jan 17, 2025

Regression Detector (DogStatsD)

Regression Detector Results

Run ID: f22a284b-fe5a-4b96-97cb-0e3735117157

Baseline: 7.62.0-rc.2
Comparison: 7.62.0-rc.2

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gates_idle_rss memory utilization +1.02 [+0.94, +1.09] 1
dsd_uds_100mb_3k_contexts_distributions_only memory utilization +0.86 [+0.65, +1.06] 1
dsd_uds_100mb_3k_contexts ingress throughput +0.02 [-0.03, +0.06] 1
dsd_uds_1mb_50k_contexts_memlimit ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_500mb_3k_contexts ingress throughput -0.00 [-0.01, +0.01] 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.00, +0.00] 1
dsd_uds_100mb_250k_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_3k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_10mb_3k_contexts ingress throughput -0.00 [-0.02, +0.01] 1
dsd_uds_40mb_12k_contexts_40_senders ingress throughput -0.00 [-0.01, +0.00] 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 Jan 17, 2025

Regression Detector (Saluki)

Regression Detector Results

Run ID: 2c6f7660-bb7e-4e66-bca7-8ce0aaf59bce

Baseline: 799f140
Comparison: ee396d5
Diff

❌ Experiments with missing or malformed data

This is a critical error. No usable optimization goal data was produced by the listed experiments. This may be a result of misconfiguration. Ping #single-machine-performance and we can help out.

  • dsd_uds_100mb_3k_contexts

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 +2.84 [+2.36, +3.33] 1
dsd_uds_500mb_3k_contexts ingress throughput +1.66 [+1.55, +1.76] 1
dsd_uds_100mb_3k_contexts_distributions_only memory utilization +0.23 [+0.11, +0.36] 1
dsd_uds_50mb_10k_contexts_no_inlining ingress throughput +0.01 [-0.05, +0.08] 1
dsd_uds_50mb_10k_contexts_no_inlining_no_allocs ingress throughput +0.01 [-0.04, +0.05] 1
dsd_uds_40mb_12k_contexts_40_senders ingress throughput +0.00 [-0.03, +0.04] 1
dsd_uds_1mb_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_10mb_3k_contexts ingress throughput +0.00 [-0.04, +0.04] 1
dsd_uds_1mb_50k_contexts ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_100mb_250k_contexts ingress throughput -0.00 [-0.03, +0.02] 1
dsd_uds_1mb_3k_contexts_dualship ingress throughput -0.01 [-0.01, +0.00] 1
quality_gates_idle_rss memory utilization -0.02 [-0.05, +0.01] 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 Jan 17, 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]

@@ -243,7 +243,18 @@ where
}
}

impl<'a> Tagged for &'a [&'static str] {
impl<'a> Tagged for &'a [&'a str] {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It feels like a lot of these could be covered with something like

impl<T, S> Tagged for T
where
    T: IntoIterator<Item=S>,
    S: AsRef<str>,
{
    fn visit_tags<F>(self, mut visitor: F)
    where
        F: FnMut(&str),
    {
        for tag in self {
            visitor(tag.as_ref());
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Core functionality, event model, etc. type/enhancement An enhancement in functionality or support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants