Provisioned Vs Serverless Cosmos Best Option

James Tordoff 0 Reputation points
2024-03-19T13:07:34.5833333+00:00

For an instance where there's a small amount of RU usage constantly, with large spikes at irregular intervals, would the Serverless approach be better suited than Provisioned?

In my case, there would be a small constant stream of inserts, which should use around 10-20RU each per second at all times. Then at random intervals (E.g. just a few times a day) I would retreive around 300,000 records back.

From what I've tested, retreiving 300,000 records would charge about 11,000RU (as an estimate).

Would setting a privisioned account of X RU/s be worth considering, or would serverless be the obvious choice here?

I'm new to everything cosmos so I apologise if this is an obvious question.

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

2 answers

Sort by: Most helpful
  1. Azar 29,525 Reputation points MVP Volunteer Moderator
    2024-03-19T13:16:41.3866667+00:00

    Hey there James Tordoff

    Thats a great question and thanks for using QandA platform,

    lemme try claring this up for you.

    Provisioned

    This option is like reserving a set number of lanes on the highway just for yourself. You pay a fixed amount for a certain number of request units per second (RU/s), regardless of whether you're using them or not.

    It's great for predictable workloads where you know exactly how much traffic you'll have.

    If you can accurately estimate your peak retrieval times and are okay with paying for those reserved lanes even when you're not using them, this could be a good choice.

    Serverless

    Think of this as a pay-as-you-go model. You only pay for what you use, kind of like paying for tolls based on the distance you travel.

    It's perfect for unpredictable workloads because you're not locked into any fixed capacity. Plus, you don't have to worry about over-provisioning or under-provisioning.

    In your case, since you only have occasional retrieval, serverless could save you money during quieter periods, as you're not paying for resources you're not using.

    https://learn.microsoft.com/en-us/search/?terms=%20Serverless%20Cosmos&category=Documentation

    If this helps kindly accept the answer thanks much.


  2. Oury Ba-MSFT 21,016 Reputation points Microsoft Employee Moderator
    2024-03-19T22:15:54.5566667+00:00

    @James Tordoff

    Thank you for reaching out.

    To decide between provisioned throughput and serverless, estimate your overall expected consumption. Consider the total number of RUs you may consume over a month.

    Please example in the link below.

    You can perform the exact same database operations in both modes, but the way you get billed for these operations is radically different.

    In your case, with a small constant stream of inserts and occasional retrievals, serverless might be a more cost-effective choice.

    Please do also review this detailed comparison with examples between both capacity modes How to choose between provisioned throughput and serverless

    Helpful links:

    Introduction to provisioned throughput in Azure Cosmos DB

    Azure Cosmos DB serverless account type

    Regards,

    Oury


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.