imranmomin / Hangfire.AzureCosmosDb

Azure Cosmos DB storage provider for Hangfire
https://www.hangfire.io/
MIT License
18 stars 17 forks source link

Making partition key configurable #6

Closed TeeNak closed 4 years ago

TeeNak commented 4 years ago

Description

This is just a proposal. Making partition key configurable will be helpful in some situations.

Purpose

I have a currently running service which uses one CosmosDB container which is not fully utilizing the 400RU minimum. Though it is natural to have two container to serve each purpose, but it is also common to have mixed type object container like you already do to save the money particularly in azure CosmosDB world. If we could change the name of partition key that will help a lot.

imranmomin commented 4 years ago

currently the partition is based on 'type' field. Across the library I pass the field value to query only within the partition. I'm not sure how can I make the partition key configurable.

TeeNak commented 4 years ago

Any chance to merge my PR if I could change this?

graemechristie commented 4 years ago

You can have shared bandwidth across multiple containers in a database, so you can already create a database with for e.g. 400RU's and create 2 separate containers in that database that share those RU's (so cost is the same as if you had put all the documents in both those containers in the same container, but perf will likely be much better).

If you left the partition key as user configurable, you would be opening yourself up to potentially massive performance issues if the wrong field was selected to partition by.

imranmomin commented 4 years ago

Agree @graemechristie

TeeNak commented 4 years ago

@graemechristie @imranmomin OK. I may have wrong understanding for throughput per database. Agree to close this issue.