Skip to content

Key the v0.5 trace dictionary by string content (quick perf fix) - #13400

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
dougqh/v05-dictionary-string-keys
Nov 13, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
dougqh/v05-dictionary-string-keys

Conversation

@dougqh

@dougqh dougqh commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

TraceMapperV0_5 now keys its string dictionary by content: a CharSequence other than String or UTF8BytesString is converted to a String before the lookup, as v1's string table already does. Values longer than the dictionary are still rejected without being converted (#13024's bound).

Motivation

The v0.5 dictionary only deduplicates values that are equals. URIUtils.LazyUrl overrides hashCode() (its content's hash) but not equals(), so:

  • every request's http.url became its own dictionary entry, re-encoding the same URL into the payload each time, and
  • all of them landed in one HashMap bucket. The bucket treeifies past 8 entries, but LazyUrl isn't Comparable, so each lookup walked every entry: serializing went quadratic in the requests per payload.

Profiling PetClinic owner-detail (2 GB heap, constant 8,000 req/s, 100% sampled), 85–89% of the v0.5 serializer thread's CPU samples were in HashMap$TreeNode.find / HashMap.comparableClassFor.

v0.5, same commit, ABBA runs serializer CPU samples in TreeNode.find p90 p99
before 347 / 257 294 / 230 2.33 / 0.68 ms 37.8 / 20.2 ms
after 57 / 62 0 / 0 0.62 / 0.74 ms 14.8 / 17.2 ms
v0.4 (reference) 91 0 1.84 ms 17.6 ms

With the fix, v0.5 serializes more cheaply than v0.4 while sending far fewer bytes (~8× fewer than v0.4 even before this fix), and its p90 is close to OpenTelemetry's ~0.5 ms on the same setup.

Additional Notes

🤖 Generated with Claude Code

TraceMapperV0_5 keys its string dictionary on the value as written, and
deduplicates only values that are equals. URIUtils.LazyUrl hashes its
content but keeps identity equality, so every request's http.url became its
own dictionary entry, all in one hash bucket. HashMap treeifies the bucket,
but LazyUrl isn't Comparable, so each lookup walked every entry: serializing
went quadratic in the requests per payload, and the URL was re-encoded into
the dictionary each time.

Convert CharSequences other than String and UTF8BytesString to String before
the lookup (LazyUrl caches its rendering, so this is free), as v1's string
table already does. Values longer than the dictionary are still rejected
without being converted.

PetClinic owner-detail, 2 GB heap, 8,000 req/s, 100% sampled, v0.5: the
serializer thread's CPU samples drop from 257-347 (85-89% in
HashMap$TreeNode.find / comparableClassFor) to 57-62, below v0.4's 91; p90
0.62-0.74 ms vs 1.84 ms for v0.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added type: bug fix Bug fix comp: core Tracer core tag: performance Performance related changes tag: ai generated Largely based on code generated by an AI or LLM labels Nov 12, 2026
@dougqh
dougqh marked this pull request as ready for review November 12, 2026 13:39
@dougqh
dougqh requested review from a team as code owners November 12, 2026 13:39
@dougqh
dougqh requested review from PerfectSlayer, ygree and zacharycmontoya and removed request for a team November 12, 2026 13:39
@dd-octo-sts

dd-octo-sts Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Remove the issue linking keyword

If you need help, please check our contributing guidelines.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T13:48:34.198638Z 3c3fd56 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dougqh dougqh changed the title Key the v0.5 trace dictionary by string content Key the v0.5 trace dictionary by string content (quick perf fix) Nov 12, 2026

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

Content-based keys address repeated LazyUrl dictionary entries while preserving the pre-conversion capacity guard. Static review found no reportable defect.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3c3fd56

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 61.20% (+1.44%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3c3fd56 | Docs | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c3fd567b9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dd-octo-sts

dd-octo-sts Bot commented Nov 12, 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.01 s 13.95 s [-0.1%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 12.99 s [-1.2%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.67 s 17.53 s [+0.0%; +1.6%] (maybe worse)
startup:petclinic:iast:Agent 17.44 s 17.58 s [-1.6%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.32 s 17.29 s [-0.9%; +1.2%] (no difference)
startup:petclinic:sca:Agent 17.63 s 17.54 s [-0.3%; +1.3%] (no difference)
startup:petclinic:tracing:Agent 16.58 s 16.68 s [-1.7%; +0.5%] (no difference)

Commit: 3c3fd567 · 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.

@dougqh

dougqh commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-13 01:52:51 UTC ℹ️ Start processing command /merge


2026-11-13 01:53:03 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-13 01:55:07 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-13 03:03:29 UTC ❌ MergeQueue: The build pipeline failed for this merge request

Build pipeline has failing jobs for 49c836d:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@dougqh

dougqh commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-13 13:20:09 UTC ℹ️ Start processing command /merge


2026-11-13 13:20:14 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-13 14:23:22 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 1e5d888 into master Nov 13, 2026
705 of 713 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dougqh/v05-dictionary-string-keys branch November 13, 2026 14:23
@github-actions github-actions Bot added this to the 1.69.0 milestone Nov 13, 2026
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: performance Performance related changes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants