Cosmos DB serverless very slow write performance

Casper Rubæk 246 Reputation points
2022-08-01T14:49:20.043+00:00

I am using Cosmos DB serverless in the West US region and when I create 1 item that looks like this it takes about 3 seconds every time to write to the database to a nearly empty container:

{
"id":"1ad8198711-ad8198181",
"TenantId":"aalkdlj8819",
"Channels": [ "Android"],
"Feed": "UserSignup",
"Message": "User X signed up on .."
}

I am located in Europe when I do the call to Cosmos DB, thus I would expect the response latency to be around 200 msec excluding the time needed to write to the database.

Is this the expected performance of the serverless option?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Brown - MSFT 2,771 Reputation points Microsoft Employee
    2022-08-01T15:28:52.8+00:00

    Azure Cosmos DB Serverless, just like other serverless offerings in Azure and elsewhere does not provide SLA's for guaranteed latency or performance. Rather it has an SLO rather of about < 30ms. However, latencies across a WAN can be very unpredictable. Even with provisioned throughput which has SLA's for latency, these only apply to requests made in-region, not across Azure's WAN or public internet and only apply to the .NET or Java SDK's using TCP direct-mode connections.

    Another thing to note is that connections take considerable time when initially configuring. If you are making these requests from a cold start from your application, this amount of latency is expected. To avoid this, start your app ahead of time and keep it warm between requests. You can learn more about best practices using Cosmos DB in our docs.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.