How to Allocate Resources

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

Original topic: 如何 资源分配

| username: 等一分钟

In the case of limited resources, should the resources be inclined towards tidb_server or tikv?
tidb_server has OOM phenomena, while tikv seems to have not been discovered.

| username: Fly-bird | Original post link

What are your specific resources? The majority of resources should definitely be allocated to TiKV, as both data and computation are handled there.

| username: 等一分钟 | Original post link

However, I feel that tidb_server seems to consume more memory and may cause OOM.

| username: Kongdom | Original post link

The resources required for different nodes are different. However, TiKV is prioritized overall.

| username: 等一分钟 | Original post link

How should the resources be allocated for 6 machines with 8 cores and 32GB of RAM each? The machine configuration can also be adjusted.

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

TiDB server OOM is usually an SQL issue, and the SQL needs to be optimized.

| username: Kongdom | Original post link

3 TiDB+PD mixed deployment, 3 TiKV

| username: 等一分钟 | Original post link

Is each one 8C32G?

| username: 等一分钟 | Original post link

The total resources are 6 machines with 8 cores and 32GB each, and each machine can be freely adjusted.

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

How large is your data volume? Your server configuration does not meet the recommended configuration on the official website.

| username: 等一分钟 | Original post link

I didn’t have as many resources at the beginning.

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

Then you should follow the setup mentioned above: 3 TiDB+PD mixed deployment, 3 TiKV. It’s crucial that the KV nodes use SSDs as they are very disk-intensive.

| username: 等一分钟 | Original post link

The CPU and memory of the 6 machines do not need to be adjusted, right? They are all 8C32G.

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

If it’s a new system, set it up and let it run for a while to see how it performs. If it’s not sufficient, add more resources. In the meantime, closely monitor the information.

| username: 等一分钟 | Original post link

Can the total memory of tidb_server be limited to prevent it from OOM?

| username: 昵称想不起来了 | Original post link

You can check the official website to understand the parameters for memory control: TiDB 内存控制文档 | PingCAP 文档中心

| username: 大飞哥online | Original post link

3 TiDB+PD mixed deployment, 3 TiKV

There are parameters to control memory, as well as memory used by a single SQL. You can check the documentation.

| username: Kongdom | Original post link

Is your business inclined towards OLTP or OLAP?
If it’s OLAP, then set up 1 TiDB, 1 PD, 3 TiKV, and 1 TiFlash :thinking:

| username: Soysauce520 | Original post link

TiKV will also, but less so. It depends on the amount of data you scan and the amount of computation.

| username: DBRE | Original post link

TiDB OOM problem diagnosis can refer to: https://mp.weixin.qq.com/s/KK7GffPmk_rMCRpYz_ZZyg