Skip to content

Annotate DDCache/SimpleUtf8Cache/GenerationalUtf8Cache with @ForegroundSafe / @BackgroundOnly - #12472

Draft
dougqh wants to merge 1 commit into
dougqh/foreground-safe-background-only-annotationsfrom
dougqh/annotate-foreground-background-caches
Draft

Annotate DDCache/SimpleUtf8Cache/GenerationalUtf8Cache with @ForegroundSafe / @BackgroundOnly#12472
dougqh wants to merge 1 commit into
dougqh/foreground-safe-background-only-annotationsfrom
dougqh/annotate-foreground-background-caches

Conversation

@dougqh

@dougqh dougqh commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Marks DDCache @ForegroundSafe — every implementation looks up a key via a small, bounded number of probes, cheap enough to call from an application thread.
  • Marks SimpleUtf8Cache and GenerationalUtf8Cache @BackgroundOnly — both trade CPU for allocation savings that only pay off when run on a background thread (their own Javadoc already notes they're more CPU-expensive than a direct String.getBytes call); confine them to the background serializer thread.
  • Each annotation site carries a short rationale in the Javadoc per APMLP-1544's acceptance criteria.
  • Stacked on Add @ForegroundSafe / @BackgroundOnly marker annotations #12471 (the annotation types themselves) — this PR only exists once that one lands.

Implements APMLP-1544.

Test plan

  • techdebt review: no issues.
  • perf-review review: no findings (documentation-only, zero behavior change, SOURCE retention).
  • :internal-api:compileJava / :communication:compileJava succeed.
  • ./gradlew spotlessCheck

🤖 Generated with Claude Code

…ndSafe / @BackgroundOnly

DDCache is cheap (small, bounded probe count) -- safe to call from
application threads. SimpleUtf8Cache and GenerationalUtf8Cache trade CPU
for allocation savings that only pay off when run on a background
thread, so they're confined to the background serializer thread.

APMLP-1544

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dougqh dougqh added tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes comp: core Tracer core type: feature Enhancements and improvements labels Sep 11, 2026
@datadog-official

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.00 s 13.93 s [-0.4%; +1.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.98 s 13.05 s [-1.3%; +0.1%] (no difference)
startup:petclinic:appsec:Agent 17.56 s 17.46 s [-0.4%; +1.6%] (no difference)
startup:petclinic:iast:Agent 17.49 s 17.58 s [-1.4%; +0.4%] (no difference)
startup:petclinic:profiling:Agent 16.99 s 16.88 s [-5.4%; +6.8%] (unstable)
startup:petclinic:sca:Agent 17.50 s 17.44 s [-0.6%; +1.2%] (no difference)
startup:petclinic:tracing:Agent 16.53 s 16.60 s [-1.5%; +0.6%] (no difference)

Commit: 7792b1de · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant