Franky
Franky

Reputation: 1574

Using Azure CosmosDB container to move object to different status

I wonder if it's a good idea to use Azure Cosmos DB "container" to manage an entity's status? For example, an employee's reimbursement can have different statuses like submitted, approved, paid, etc. Do you see any problem creating a separate container for "Submitted", "Approved", etc? They would contain the similar reimbursement object but slightly different data points due to their status. For example, Submitted container could have Manager's name as the approver, Paid container could have payment method.

In other words, it's like a persistent queue. It will be moved out of the container and into the next in the workflow process.

Are there any concerns with this approach? Does Azure pricing model "provisioned throughput" charge by the container? Meaning the more container you have, the more expensive it gets? Or is it on the database level so that I can have as many containers I want, it's only charging the queries?

Sorry for the newbie questions, learning about Cosmos. Thanks for any advice!

Upvotes: 0

Views: 232

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

It's a two part question :).

First part (single container v/s multiple container) is basically an "opionion-based" question. I would have opted for a single container approach as it would have given me just one place to look for the current status of an item. But, that's just my opinion :).

Regarding your question about pricing model, Azure Cosmos DB offers you both.

You can provision throughput at the container level as well as on the database level. When you provision throughput at the database level, all containers (up to 25) in that database will share the throughput of the database.

You can even mix and match the approaches as well i.e. you can have throughput provisioned at the database level and then have some containers share the throughput of the database while some containers have dedicated throughput.

Please note that once throughput type (fixed, shared or auto-scale) is configured at the database/container level, it can't be changed. You will have to delete and create new resource with changed throughput type.

You can learn more about throughput here: https://learn.microsoft.com/en-us/azure/cosmos-db/set-throughput.

Upvotes: 2

Related Questions