Law of large numbers and MySQL static sharding bitsCN.com
Law of large numbers and static MySQL sharding
Sharding has two advantages: static and dynamic sharding and static sharding. they are simple, low development costs, and low maintenance costs.
Common static sharding methods include hash functions and modulo operations, but this exposes a disadvantage (PS: There are many disadvantages ):
This disadvantage is as follows:
When static Sharding is adopted, we cannot define which Shard the data is put into. if there is some data, it is more active than other data.
Moreover, unfortunately, these radical data is distributed to the same shard, and the header is large.
We cannot balance the load by transferring hotspot data
At this time, with the help of the law of big numbers, what is the law of big numbers? In a word, it is as follows:
"A large enough sample can almost certainly reflect the real composition of the whole", detailed principles, Google
If the data volume of each shard is small, it is easier to evenly distribute hotspot data to different shards according to the law of large numbers.
Of course, this may cause cross-partition queries, depending on how you tradeoff
BitsCN.com