Skip to content

Skip DDB Enhanced Client extension processing for unusued extensions#6743

Closed
RanVaknin wants to merge 3 commits intomasterfrom
rvaknin/ddb-enhanced-optimization-avoid-extension-context-hooks
Closed

Skip DDB Enhanced Client extension processing for unusued extensions#6743
RanVaknin wants to merge 3 commits intomasterfrom
rvaknin/ddb-enhanced-optimization-avoid-extension-context-hooks

Conversation

@RanVaknin
Copy link
Contributor

@RanVaknin RanVaknin commented Feb 19, 2026

[SURFACE API CHANGE - NEEDS REVIEW]

Context

The extension system creates context objects and invokes all configured extensions on every operation. By default, the Enhanced Client includes VersionedRecordExtension and AtomicCounterExtension, which run even when beans don't use either extension.

ChainExtension invokes each extension's beforeWrite() and afterRead() methods, creating a context object for each invocation. With 2 default extensions, this overhead accounts for ~2-15% CPU time, including extension invocation, context creation, and result merging.

This PR adds shouldProcess() method to the DynamoDbEnhancedClientExtension interface with a default implementation returning true for backwards compatibility.
Extensions can override this method to check if they're configured for a specific table schema.

Flamegrahps

Put SMALL

Before
two calls ~8% + ~3% around ~11%
image

After
image

Results:

Operation Size V2 Master Mean (us/op) optimized Improvement
Delete TINY 0.396 0.431 -8.12%
Delete SMALL 0.387 0.387 0.00%
Delete HUGE 0.392 0.384 2.08%
Delete HUGE_FLAT 0.397 0.39 1.79%
Get TINY 0.462 0.489 -5.52%
Get SMALL 0.975 0.98 -0.51%
Get HUGE 10.198 9.821 3.84%
Get HUGE_FLAT 3.024 3.056 -1.05%
Put TINY 0.688 0.625 10.08%
Put SMALL 1.345 1.22 10.25%
Put HUGE 13.482 13.107 2.86%
Put HUGE_FLAT 7.595 7.964 -4.63%
Query TINY 2.557 2.487 2.81%
Query SMALL 4.162 4.084 1.91%
Query HUGE 31.065 29.631 4.84%
Query HUGE_FLAT 8.975 9.165 -2.07%
Scan TINY 1.080 1.082 -0.18%
Scan SMALL 2.577 2.671 -3.52%
Scan HUGE 30.366 30.25 0.38%
Scan HUGE_FLAT 8.105 8.357 -3.02%
Update TINY 1.277 1.259 1.43%
Update SMALL 9.241 9.305 -0.69%
Update HUGE 39.486 38.944 1.39%
Update HUGE_FLAT 232.677 243.128 -4.30%

@RanVaknin RanVaknin requested a review from a team as a code owner February 19, 2026 00:11
@RanVaknin
Copy link
Contributor Author

Results are inconclusive. The overhead we are eliminating is likely cancelled by the new interface method checking.

@RanVaknin RanVaknin closed this Feb 24, 2026
@github-actions
Copy link

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant