Modify the Default Region Size of TiDB

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

Original topic: 修改tidb默认region的大小

| username: yulei7633

[TiDB Usage Environment] Production Environment / Testing / PoC
When the number of regions reaches 50,000, due to the need for regions to constantly interact with PD, it will cause performance degradation. Since the data volume in my company is at the terabyte level, it is necessary to modify the default size of the region to reduce the number of regions.

[TiDB Version]
v5.0.0

[Reproduction Path] What operations were performed to encounter the issue

[Encountered Issue: Issue Phenomenon and Impact]

[Resource Configuration]
tiup cluster edit-config tidb-test

server_configs:
tidb: {}
tikv:
coprocessor.region-bucket-size: 192MiB
coprocessor.region-max-keys: 2880000
coprocessor.region-max-size: 288MiB
coprocessor.region-size-threshold-for-approximate: 2880MiB
coprocessor.region-split-keys: 1920000
coprocessor.region-split-size: 192MiB
rocksdb.writecf.write-buffer-size: 256M
storage.flow-control.memtables-threshold: 10

[Attachments: Screenshots/Logs/Monitoring]

| username: xingzhenxiang | Original post link

There are nearly 2 million regions in v3.1.0, indicating no issues. Should we try downgrading the version?

| username: Kongdom | Original post link

It seems like version 5.0 is not supported.

| username: Kongdom | Original post link

You can refer to the official documentation for some tuning.

| username: 啦啦啦啦啦 | Original post link

It is not recommended to adjust the region size in a production environment. There are many official solutions for optimizing the issue of having too many regions. You can refer to the link provided by the expert above.

| username: xingzhenxiang | Original post link

Received with thanks.

| username: xingzhenxiang | Original post link

I remember MongoDB seems to have a default chunk size of only 64MB, which I think is enough by default.

The recommended Region sizes are 96 MiB, 128 MiB, and 256 MiB.

How did you come up with this coprocessor.region-split-size: 192MiB?

| username: yulei7633 | Original post link

After testing, it is indeed impossible to modify in v5.0.0. After upgrading to v6.1.0, it can be modified. Learned something new, thank you.

| username: yulei7633 | Original post link

Learned, thank you.

| username: yulei7633 | Original post link

I just simply *2

| username: xingzhenxiang | Original post link

I think it’s better to follow the official website’s recommendations.

| username: Hacker_ufuLjDKs | Original post link

Learned.

| username: Alex920 | Original post link

You need to upgrade to version v6.

| username: Kongdom | Original post link

Remember to mark the issue as resolved~ :handshake: :handshake: :handshake:
image

| username: yulei7633 | Original post link

Marked, thank you.

| username: Kongdom | Original post link

:handshake: :handshake: :handshake:

| username: maokl | Original post link

Upgrade the version first.

| username: yulei7633 | Original post link

I am also just in the testing and learning phase.

| username: system | Original post link

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