-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk executor cache #857
Bulk executor cache #857
Conversation
Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs
Outdated
Show resolved
Hide resolved
One more alternative is to include Executor at Partition cache. On similar notes CollectionCache can also be leveraged. Its very specific to SDK code. |
Update from offline sync-up:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extending existing stateless caches is non-trivial -> new cache is good
Bulk needs to cover Gone with NameCacheStale in Retry Policies
Prefer AsyncCache< Executors>
@kirankumarkolli Retry policy for NameStaleCache is a separate PR, see #859 Updated PR to use AsyncCache |
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/DotNetSDKAPI.json
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No contract change but contract file touched.
Its worth a mention in release notes. |
Pull Request Template
Description
Currently we are maintaining the Executor instance as part of the Container instance, but the Container instance is really too ephemereal and users could be calling
GetContainer
multiple times for the same container across their code, in which case we would end up creating a lot of Executor instances that would not be used or worse, the desired performance effect would not be reached if the concurrent operations are using different Container instances for the same container name.This PR introduces a cache at the Client level to have one Executor per Container based on the Link. This way, Executor instances can be shared across Container instances representing the same container and hence, achieving the desired performance benefit even when the user is calling
GetContainer
from concurrent threads.The Executor cache is maintained in sync when DeleteContainer operations are issued, by removing cache entries for deleted containers.
The cache is also tied to the CosmosClient lifetime, when the client is disposed, the Executor cache and instances get disposed.