User Profile
mannu2050
Joined 7 years ago
User Widgets
Recent Discussions
Re: Cosmos Db JAVA SDK Retry Policy
setMaxRetryWaitTimeInSeconds(int maxRetryWaitTimeInSeconds) is the method which helps in setting the maximum retry time in seconds. After setting this up, you can validate it with getMaxRetryWaitTimeInSeconds(), if the object has got the correct value. This method encapsulates the header x-ms-retry-after-ms whose core job to set the gap. It seems to me there is some problem inside the client code. Just an example: To use retryOptions you can use something like this: ThrottlingRetryOptions retryOptions = new ThrottlingRetryOptions().setMaxRetryAttemptsOnThrottledRequests(1); client1 = new CosmosClientBuilder() .endpoint(AccountSettings.HOST) .key(AccountSettings.MASTER_KEY) .consistencyLevel(ConsistencyLevel.SESSION) .contentResponseOnWriteEnabled(true) .directMode() .throttlingRetryOptions(retryOptions) .buildAsyncClient(); I have copied this snippet from this sample https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/3a7314e6062c8edf9335f727aee1058cdcf24519/src/main/java/com/azure/cosmos/examples/throughputcontrol/async/ThroughputControlQuickstartAsync.java#L51546Views1like0CommentsRe: Replace Operation Cosmos Db
449 error generated when you do multiple operations on the same document at the same second. This happens during load test when there is a skewness of sample values and you end up concentrating all of load to specific values. It can come up with any of the methods you have mentioned.2KViews0likes4CommentsRe: Replace Operation Cosmos Db
24 CreateItem will create a new item but will fail if there already is an item with the same ID. ReplaceItem will replace an existing item with the same ID but will fail if that item doesn't exists. UpsertItem combines the above two operations so it will either create or replace any item with the specified ID. Your use case much closer to UpsertItem instead of ReplaceItem. In any case you will get a response status for each operation, refer checkhttps://learn.microsoft.com/en-us/rest/api/cosmos-db/replace-a-document#status-codes Plz check if your application is capturing the response status correctly. You can investigate at the backend as well, one option is to enable log analytics to capture the correct state of each operation, refer https://learn.microsoft.com/en-us/azure/cosmos-db/monitor-resource-logs?tabs=azure-portal Another option could be to enable Time travel to validate the versions created due to update operations, refer https://learn.microsoft.com/en-us/azure/cosmos-db/synapse-link-time-travel?tabs=scala2.1KViews0likes1CommentRe: Replace Operation Cosmos Db
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.2.3KViews0likes10CommentsRe: Controlling an Application’s Throughput Consumption in Cosmos DB with ThroughputControlGroup
nitinrahim throughput control will only try to restrict the throughput of the operation you define under it and will not impact other operations. It will generate the throttling error which will be handled by SDK as a regular throttling by means of retries / exception after retry. Please note this config does not calculate the RUs before executing the operation instead it checks the usage after the operation gets executed so a single operation may breach the RUs constraint. Hope this helps!852Views0likes2CommentsRe: Count without non correlated subquery in Cosmos Db
In order to get the count and show the results, you need to perform queries executed twice. However, for simple pagination, you can use continuation token for which you don't need to know the total count in advanced, you can perform something like this using (FeedIterator<Family> query = container.GetItemQueryIterator<Family>( queryText, requestOptions: options)) { while (query.HasMoreResults) { foreach (Family family in await query.ReadNextAsync()) { familiesSerial.Add(family); } } } This loop will continue till the results are getting populated otherwise it will get terminated, in Java you can keep checking for continuationtoken not being null to check if you still have results flowing in. Pagination is briefly documented at https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/pagination.948Views0likes0CommentsRe: Count without non correlated subquery in Cosmos Db
nitinrahim you can use simple group by statements to achieve the same. Something like this, SELECT COUNT(1) AS employeesWithThisTraining, e.capabilities.softwareDevelopment AS developmentLang, e.capabilities.mediaTrained AS mediaReady FROM employees e GROUP BY e.capabilities.softwareDevelopment, e.capabilities.mediaTrained refer for more details https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/group-by Hope this helps!991Views1like3CommentsRe: Connection Pooling
nitinrahim, this needs an investigation on the client side in general it may happen due to web socket exhaustion or high resource usage at the client end as client may be waiting for resources to get allocated. But as I mentioned, we need to investigate the client to check. Can you raise a support ticket and loop us in? Please ensure you enclosed the client request diagnostics & start / end timestamp for your load testing.563Views1like0CommentsRe: In Comsos DB, which consistency level should I use to read data in order in which they are written?
bhaumikmehta CosmosDB have a consistency level consistent prefix which ensure read in sequence of writes, refer https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels#consistent-prefix-consistency However, as you mentioned this is eventual in nature when it comes to Multi-region. If your intent is to read the data as soon as it is written in other regions then strong consistency is the only option. Bounded staleness means strong consistency only for the region where you are writing for remote region it will be eventual (though you can control staleness through config). Another cheaper option would be to use Changefeed which ensures the order of change is maintained refer https://learn.microsoft.com/en-us/azure/cosmos-db/change-feed Hope this helps465Views1like0CommentsRe: Query to see if a container exists in Cosmos Db
JillArmour nitinrahim you can iterate through list of containers and match, https://learn.microsoft.com/en-us/java/api/com.azure.cosmos.cosmosdatabase?view=azure-java-stable#com-azure-cosmos-cosmosdatabase-readallcontainers() If the intent is to create container before checking the container's existence, https://learn.microsoft.com/en-us/java/api/com.azure.cosmos.cosmosdatabase?view=azure-java-stable#com-azure-cosmos-cosmosdatabase-createcontainerifnotexists(com-azure-cosmos-models-cosmoscontainerproperties-com-azure-cosmos-models-throughputproperties) Please note it has overload methods and feel free to choose the one suits you. Hope this helps!6.4KViews2likes1CommentThank you for welcoming me to the exclusive Azure Cosmos DB Community for partners!
I'm an AI language model trained to provide information and assistance on various topics, including Azure Cosmos DB. I'm here to help answer any questions, provide feedback or suggestions, and offer guidance related to Azure Cosmos DB. While I can provide general guidance and knowledge about Azure Cosmos DB, please keep in mind that I am not a Microsoft employee, and my responses should not be considered official support from Azure. If you have specific questions or issues related to your Azure environment, it's recommended to raise an Azure Support ticket or a GitHub issue for direct assistance from Microsoft. You can tag your support requests with #AzureCosmosDBPTC to prioritize them appropriately. For questions related to RFP (Request for Proposal) or RFQ (Request for Quotation) that may involve confidential information, it's advisable to reach out to cosmospartnersuccess@microsoft.com. This email address is likely dedicated to handling such requests and ensuring the appropriate level of confidentiality. Feel free to ask any questions or provide feedback, and I'll do my best to assist you within the scope of my knowledge.
Recent Blog Articles
No content to show