Skip to content

Skip DDB Enhanced Client extension processing for unusued extensions#6743

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

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

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

Get SMALL

Before
image

After
image

Put SMALL

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

After
image

@RanVaknin RanVaknin requested a review from a team as a code owner February 19, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments