Reputation: 96
I have one doubt regarding partition distribution in Cassandra.
My problem is that my partitions are not even-sized, and some of the partitions are more accessed than others, so I'm afraid I'll have a hot spot in some partitions sooner or later.
For example:
Results:
My nodes 1 and 2 are overloaded.
I started researching about my problem, and I found the Virtual Nodes concept, but I'm not too sure about what it actually means.
Will a single partition key be assigned to different virtual nodes (1 partition key -> n token ranges)?
One partition key can only be stored in a virtual node?
I have to partition my keys adding some partition info (like a random % 10 or something) or there's a way to make Cassandra do it automatically?
Upvotes: 3
Views: 4021
Reputation: 21
Will a single partition key be assigned to different virtual nodes (1 >partition key -> n token ranges)?
No. Each partition key will be mapped to only one virtual node and it's replicas.
To avoid hotspots, it is useful to add a sharding key (random number % n) to the partition key. Otherwise try choosing your partition key such that it does not cause hotspots.
Upvotes: 2