Giter Site home page Giter Site logo

Comments (11)

AndriySvyryd avatar AndriySvyryd commented on September 18, 2024 2

@ealsur I see, then we would still need a way of running the custom handler before the default one or removing it.

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on September 18, 2024
  1. What's the use case for multiple paths?
  2. Currently there are several dependencies that use this, but an issue can be created to track it..
  3. This is a good idea. Need to create an issue to track the feature request
  4. The type is required to deserialize the response stream to the object.
  5. I believe the rename will be the best option. We moved it to a parameter to make sure developers are aware of it, and for it to be easier to set.
  6. There currently is a bug that is preventing most partition key types and that will be fixed in the next release. We can definitely add more documentation to clarify the requirements.
  7. The CosmosConfiguration contains MaxRetryAttemptsOnThrottledRequests and MaxRetryWaitTimeOnThrottledRequests . Are there additional properties or settings that are needed?
  8. An issue can be created for this.

from azure-cosmos-dotnet-v3.

AndriySvyryd avatar AndriySvyryd commented on September 18, 2024

Add a constructor to PartitionKeyDefinition that accepts an IEnumerable of paths

  1. What's the use case for multiple paths?

The benefit of the constructor is the ability to create CosmosContainerSettings in one expression:

var settings = new CosmosContainerSettings
{
    Id = parameters.ContainerId,
    PartitionKey = new PartitionKeyDefinition("/pk")
};

instead of

var pk = new PartitionKeyDefinition();
pk.Paths.Add("/pk");

var settings = new CosmosContainerSettings
{
    Id = parameters.ContainerId,
    PartitionKey = pk
};

Allow to provide a custom IDocumentClientRetryPolicy or provide a built in way of using exponential backoff.

  1. The CosmosConfiguration contains MaxRetryAttemptsOnThrottledRequests and MaxRetryWaitTimeOnThrottledRequests . Are there additional properties or settings that are needed?

For bursty highly parallelized workloads a more aggressive delay strategy could be required:

  1. Additional delay in the form of c^n where c is a user-specified value and n is the current number of failed retry attempts
  2. Additional random delay up to the specified amount

from azure-cosmos-dotnet-v3.

AndriySvyryd avatar AndriySvyryd commented on September 18, 2024

There doesn’t seem to be an advantage to have CosmosResponse.Resource be strongly typed, as the generic argument cannot always be inferred and frequently needs to be specified explicitly. Returning it as object makes using the methods like DeleteItemAsync<>() simpler as they won’t need the generic argument.

  1. The type is required to deserialize the response stream to the object.

In the case of DeleteItemAsync<T> Resource is always null

In cases where it isn't you can make deserialization lazy by changing Resource property to a method - GetResource<T>()

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on September 18, 2024
  1. There is a constructor overload that takes in the path.
var settings = new CosmosContainerSettings(
                id: "SampleContainer",
                partitionKeyPath: "/pk");

In the case of DeleteItemAsync Resource is always null

In cases where it isn't you can make deserialization lazy by changing Resource property to a method - GetResource()

  1. The reason the typed is not lazy is we wanted avoid having everything implement IDisposable. The original response back from Cosmos contains a Stream that needs to be disposed. If we did a lazy deserialization then all the responses would need to wrapped in using statements in the scenario that the objects are never deserialized. This made basic applications look very complex and was very easy for developers to have memory leaks. If you need additional performance or want to do your own deserialization you can use the stream APIs.

For bursty highly parallelized workloads a more aggressive delay strategy could be required:

Additional delay in the form of c^n where c is a user-specified value and n is the current number of failed retry attempts
Additional random delay up to the specified amount

  1. We are planning to design a new retry system based on the handler pipeline that would allow custom retry handlers. We're still in the process of planning so I'm not sure when this will be worked on.

from azure-cosmos-dotnet-v3.

AndriySvyryd avatar AndriySvyryd commented on September 18, 2024
  1. The reason the typed is not lazy is we wanted avoid having everything implement IDisposable. The original response back from Cosmos contains a Stream that needs to be disposed. If we did a lazy deserialization then all the responses would need to wrapped in using statements in the scenario that the objects are never deserialized. This made basic applications look very complex and was very easy for developers to have memory leaks. If you need additional performance or want to do your own deserialization you can use the stream APIs.

The stream APIs response needs to be disposed anyway. If you established that all responses need to be disposed it would actually make it less likely for a developer to forget to do it as it would be consistent across all of your API and shown in all samples.

from azure-cosmos-dotnet-v3.

ealsur avatar ealsur commented on September 18, 2024

@AndriySvyryd @divega Re 7: You can apply your custom retry policy as a Handler, in our samples, there is one that covers using Polly: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/CodeSamples/Handlers/ThrottlingHandler.cs

from azure-cosmos-dotnet-v3.

AndriySvyryd avatar AndriySvyryd commented on September 18, 2024

@ealsur Thanks, would that replace the built-in retry policy or would it run on top of it?

from azure-cosmos-dotnet-v3.

ealsur avatar ealsur commented on September 18, 2024

It would run on top of it. If the custom retry is covering a scenario the built-in retry handler already covers, then the default one will be applied first. V3 uses Retry handlers such as https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/Handler/RetryHandler.cs to apply the default retry policy. If no default retry handler exists to cover that case, then your custom handler would be the first responder.

from azure-cosmos-dotnet-v3.

ealsur avatar ealsur commented on September 18, 2024

Or expose the default one retry options, that would work too, just in the V2 SDK.

from azure-cosmos-dotnet-v3.

kirankumarkolli avatar kirankumarkolli commented on September 18, 2024

Please create specific issues for gaps if-any.

from azure-cosmos-dotnet-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.