Forum Discussion

nitinrahim's avatar
nitinrahim
Brass Contributor
Jan 02, 2024

Replace Operation Cosmos Db

Hi Team,

 

We have noticed that during millisecond interval sequential operations (create, read, replace operations happening in very small interval) for some records even though we don't get an error we see the cosmos database didn't do a successful replace or update on the item. Is there a limitation in the replace operation with high volume requests with respect to atomicity? 

 

With Regards,

Nitin Rahim

11 Replies

  • nitinrahim you will definitely get a response if your request is reaching to database, Azure Cosmos DB is designed to have very high concurrency, it does billions of concurrent transactions. Basis your explanation it may be that during high concurrency the client app getting challenges, please refer https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/performance-tips-java-sdk-v4?tabs=api-async to follow best practices from client side. If it doesn't solve the issue then I will recommend you to raise a support ticket. 

      • nitinrahim's avatar
        nitinrahim
        Brass Contributor

        Thanks Manish and Jill.

         

        We did notice we had response code 449 on certain replaceitem requests but on upsertItem we had 200 response for the same loadtest. Any specific reason why replace operation can encounter 449's with the same load while upsertitem won't and what does that imply?

         

        With Regards,

        Nitin Rahim

    • nitinrahim's avatar
      nitinrahim
      Brass Contributor

      Hi Manish,

       

      We don't get an error response. We are not doing concurrent transactions for this test.We are doing sequential tests one after other immediately. However for the same set of transaction if we are using upsertitem we see 100% updates from the database side,however for same loadtest with same records we see few number of items not getting updated when using replaceitem method?And this is sporadic so its not related to data issue.Wanted to understand if there is the difference with respect to replaceitem method other than it replaces the entire document with the new document and upsertitem updates if document already exists and adds if document doesn't exist? We have  a use case when were don't need to add the new document in case Id of the item doesn't exist that why we checked the replaceitem method? However we see these intermittent issues with replaceitem where even if there is no error ? Wanted to understand from backend side ( consistency level, internal replica quorum updates not getting reflected to server etc) why this difference in behavior with both of the methods( upsert vs replace) can be for the same loadtest? We are using single region write and multi region read configuration for this database.

       

      With Regards,

      Nitin Rahim

Resources