The number of regions does not match the size of the regions

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: region数量和region大小不匹配

| username: Kongdom

[TiDB Usage Environment] Production Environment
[TiDB Version] v6.5.3

As shown in the picture,
The number of regions for 102 is 941, but the region size is 61G.
The number of regions for 101 is 2499, but the region size is 42.18G.
This difference is quite large~

| username: xfworld | Original post link

It’s still a pirated version of Windows~~ :upside_down_face:

First, compare the score of the regions.
You can see that the count of regions is also very different…

The actual size and number of regions can reflect on the Size.

When the size of a Region in the range [a,e) exceeds region_max_size,
TiKV will attempt to split the Region, for example, splitting it into Regions of ranges [a,b), [b,c), [c,d), [d,e), etc.
The sizes of these Regions [a,b), [b,c), [c,d) will be region_split_size (or slightly larger than region_split_size)

region-max-size = "144MB"
region-split-size = "96MB"
| username: tidb菜鸟一只 | Original post link

There might be many empty regions. Try manually compacting and see.

| username: 大飞哥online | Original post link

101, it is possible that there are many regions that are just slightly larger than max_merge_region_size=20M, so they are not automatically merged.

| username: 大飞哥online | Original post link

You can first check the size range of most regions, then modify the max_merge_region_size parameter to allow auto merge, and then change it back later.

| username: Kongdom | Original post link

:joy: What I mean is that the fewer the number, the larger the size. It’s very strange.

| username: Kongdom | Original post link

Even with 2000 empty regions, the region size should still be roughly the same.

| username: 裤衩儿飞上天 | Original post link

Are the disk sizes of the two nodes the same?
Have you set the placement rule?

| username: Kongdom | Original post link

No additional settings were made. All are 3-node mixed deployments. This was discovered recently during expansion, which is quite strange.

| username: 像风一样的男子 | Original post link

I am also working on scaling up and down. After checking the monitoring, I found that the store region size statistics are inaccurate. Each of these KVs is 1.8T, but the monitoring shows they are all over 2T. I guess it’s because PD is constantly scheduling regions, and regions are continuously splitting and merging, making the calculations inaccurate.

| username: Kongdom | Original post link

Makes sense, probably need to restart after balancing to be accurate.

| username: Kongdom | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.