Reduce GlobalObjectStore contention by sampling underlying map size - #116
Merged
Conversation
mcculls
force-pushed
the
mcculls/sample-objectstore-map-size
branch
from
September 7, 2026 15:15
d3a4905 to
7670983
Compare
mcculls
marked this pull request as ready for review
September 7, 2026 15:24
mcculls
requested review from
amarziali and
jbachorik
and removed request for
a team
September 7, 2026 15:24
Collaborator
Author
|
@DataDog review |
…eriodically, rather on every write
mcculls
force-pushed
the
mcculls/sample-objectstore-map-size
branch
from
September 7, 2026 15:44
7670983 to
d270f39
Compare
Collaborator
Author
|
@DataDog review |
amarziali
approved these changes
Sep 7, 2026
amarziali
left a comment
There was a problem hiding this comment.
nice. lgtm I just left a couple of informative comments
There was a problem hiding this comment.
🟢 Approval recommended
The functional changes are cohesive and localized, with only minor documentation clarifications suggested.
Review details
Suppressed comments (1)
field-inject/src/main/java/datadog/instrument/fieldinject/GlobalObjectStore.java:350
LookupKey.missesis incremented by bothmiss()andskip(), so describing it as only "lookup missed" is inaccurate; clarifying this helps prevent confusion about what drives map-size sampling.
/** Number of times a lookup missed when writing. */
int misses;
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
More details
The PR reduces map-size checks during writes. The latest commit makes each thread sample on its first write, so it fixes the earlier unbounded-growth case for short-lived threads; no open findings remain.
🤖 Datadog Autotest · Commit d270f39 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What Does This Do
Reduce GlobalObjectStore contention by sampling underlying map size periodically, rather on every write
Motivation
ConcurrentHashMap.size()must sum counts across the different buckets which - we don't need to do this on every write, instead we track how many times the thread missed lookups and fell-through to use a store key. We then use this to decide when to sample the map size. This is sufficient because the thresholds are several times the sample rate.We also update the sampled size on every scheduled cleanup.
Contributor Checklist
Jira ticket: [PROJ-IDENT]