Reduce PartitionKey allocations
See original GitHub issueThe current design of the API leads to 2 extra objects being allocated for every call that takes a partition key when using a non-string value:
- A new instance of
PartitionKey
. - Boxing of the value.
One way of avoiding these would be by making PartitionKey
a generic struct.
Alternatively the overloads that take a string
instead of PartitionKey
could be added back.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Redistribute throughput across partitions (preview)
The throughput redistributing feature applies to databases and containers using provisioned throughput (manual and autoscale) and doesn't apply ...
Read more >Partitioning and horizontal scaling - Azure Cosmos DB
Learn about partitioning, logical, physical partitions in Azure Cosmos DB, best practices when choosing a partition key, and how to manage ...
Read more >Best practices for designing and using partition keys ...
Best practices for designing partition keys and using them effectively in DynamoDB.
Read more >Using write sharding to distribute workloads evenly
One way to better distribute writes across a partition key space in Amazon DynamoDB is to expand the space. You can do this...
Read more >Partitioning Behavior of DynamoDB
A partition is an allocation of storage for a table, ... When we create an item, the value of the partition key (or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AndriySvyryd thanks for the feedback.
PartitionKey as struct makes sense, it enables non–breaking optimization later. Current cosmos wire contract is we could only avoid one object heap allocation.
Generic struct vs overloaded CTOR: Usability is one concern that needs attention for generic structs. We could explore using generic’s as optimization underneath with overloaded CTOR as contract.
Should I open an issue to track further optimizations or you are tracking them elsewhere?