[WIP] DynamoDBContext TableDescription caching spike #3002
Closed
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.
Further to call with @normj and @ashovlin earlier I've sketched out a possible solution that I believe would work for our use-case where we are seeing excessive DescribeTable calls.
The aim is to reduce calls to the DescribeTable when client credentials differ per request.
Description
Added
TableDescriptionCachePrefix
toDynamoDBContextConfig
to allow a consumer provided prefix to be used when constructing a cache key for theTableDescription
cache.There are some unrelated static Table methods that would need to be given the prefix before this could be considered complete.
Motivation and Context
The existing behaviour uses the credentials in the Dynamo client to form part of the cache key. In a multi-tenancy environment where new credentials are used per request it results in the cache key having high cardinality leading to excessive DescribeTable invocations. By allowing the consumer to provide a value for the prefix we can lower this and reduce the calls to DescribeTable for the same physical table.
While this PR won't fix #1476 I believe it will reduce the symptoms to just the first series of calls after container startup.
Testing
I've included some as yet incomplete tests
Screenshots (if appropriate)
n/a
Types of changes
Checklist
License