Skip to content

Skip re-parsing an unchanged feature flag configuration without an ETag (FFE optimization) - #13554

Draft
dougqh wants to merge 2 commits into
masterfrom
dougqh/ffe-config-skip-unchanged-body
Draft

dougqh wants to merge 2 commits into
masterfrom
dougqh/ffe-config-skip-unchanged-body

Conversation

@dougqh

@dougqh dougqh commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

The CDN configuration source no longer re-parses an unchanged configuration when the endpoint sends no ETag. It keeps the SHA-256 of the last body its listener accepted, never the body itself. A poll whose decoded body has the same hash is handled like a 304: no parse and no dispatch. The poll still records the response's ETag, and still reports a new reason for ignoring the flag selection, since the server can change that without changing the configuration.

The hash is recorded only after the listener accepts the configuration, so a failed parse or dispatch is retried on the next poll. A malformed body never matches it, and a good body that returns after a malformed one is recognized as already current.

Motivation

CdnConfigurationSource sends If-None-Match only when the last applied response had an ETag. The managed endpoints send one, but a custom endpoint (feature.flags.configuration.source.agentless.base.url) may not. Without one, every poll (30 s by default) decoded and parsed the whole configuration and replaced the current one with an identical copy. That's a new graph promoted and the old one dying in the old generation every poll, plus the parse itself: 90.6 MB allocated for the 10,030-flag scale configuration.

The hash costs about 5 ms for the 8.2 MB scale body (JDK 21, best of 20) and is computed only when a body is downloaded, never on a 304.

Additional Notes

  • No change for endpoints that send ETags.

  • One test expectation changed: in CdnConfigurationSourceFlagSelectionTest.reportsEachIgnoredReasonOncePerClassLoader, the third poll returns the body its source already applied. It's now dispatched 2 times instead of 3, and its new ignored reason is still reported; the messages and metrics assertions are unchanged.

  • New tests (CdnConfigurationSourceTest):

    • the same body without an ETag, plain and gzipped, is dispatched once
    • a changed body is applied
    • an unchanged body's ETag is recorded and sent on the next poll
    • a failed dispatch is retried with the same body
    • the applied body stays current across a malformed one

    Three of them fail without the change.

  • All dd-openfeature tests pass; Spotless and SpotBugs pass.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Review follow-ups

  • Both malformed-payload catch blocks share one log helper.
  • SHA-256 is required by Java SE, so its absence throws IllegalStateException instead of silently disabling the skip.

🤖 Generated with Claude Code

The CDN source sends If-None-Match only when the last applied response had an ETag. Against an
endpoint without ETags (a custom one, for example), every poll (30 s by default) decoded and
parsed the whole configuration and replaced the current one with an identical copy: a new
graph promoted and the old one dying in the old generation, every poll.

The source now keeps the SHA-256 of the last body its listener accepted, never the body. A poll
whose decoded body has the same hash is handled like a 304: no parse and no dispatch. It still
records the response's ETag and still reports a new reason for ignoring the flag selection, since
the server can change that without changing the configuration. The hash is recorded only after
the listener accepts the configuration, so a failed parse or dispatch is retried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added type: feature Enhancements and improvements tag: performance Performance related changes tag: ai generated Largely based on code generated by an AI or LLM comp: openfeature OpenFeature labels Nov 19, 2026
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 83.33%
• Overall Coverage: 60.63% (-0.03%)

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

@dd-octo-sts

dd-octo-sts Bot commented Nov 19, 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.82 s 14.67 s [+0.2%; +1.9%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.61 s 13.69 s [-1.3%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.13 s 16.99 s [-0.1%; +1.8%] (no difference)
startup:petclinic:iast:Agent 16.48 s 16.97 s [-7.2%; +1.4%] (no difference)
startup:petclinic:profiling:Agent 16.57 s 16.21 s [-2.2%; +6.6%] (no difference)
startup:petclinic:sca:Agent 17.15 s 17.01 s [-0.1%; +1.7%] (no difference)
startup:petclinic:tracing:Agent 16.13 s 16.24 s [-1.4%; +0.1%] (no difference)

Commit: 2e327f50 · 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 changed the title Skip re-parsing an unchanged feature flag configuration without an ETag Skip re-parsing an unchanged feature flag configuration without an ETag (FFE optimization) Nov 19, 2026
Java SE requires SHA-256, so its absence is an IllegalStateException rather
than a silently disabled skip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM tag: performance Performance related changes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant