CockroachDB recommends the following best practices for the CockroachDB cluster:
- For the database pods, choose an appropriate CPU and memory configuration to suit the user requirements. For more information, see CockroachDB Production Checklist.
- .
- CockroachDB uses a lot of SSTable files in the data filesystem. Therefore, it is important to set Linux ulimit correctly for that user, based on the scale. Modify the operating system user limits. The following settings in /etc/security/limits.conf are used in this solution when running the CockroachDB.
[root@node1 ~]# vi /etc/security/limits.conf
cockroach soft nofile 102400
cockroach hard nofile 102400
cockroach soft nproc 10240
cockroach hard nproc 10240
- Enable transparent hugepages for optimal performance. Check if it is enabled by running the following command.
# cat /sys/kernel/mm/transparent_hugepage/enabled
- XFS is the recommended filesystem on the database disk. Set the default file system as XFS in the CSI values.yaml file and the default CSI storage class as vxflexos-xfs
- To make the rebalance process faster after dropping or updating databases, the following parameters can be used. In this case, for the KV database, the rebalance max rate and recovery max rate is set to 1GiB.
SET CLUSTER SETTING kv.snapshot_rebalance.max_rate = '1GiB';
SET CLUSTER SETTING kv.snapshot_recovery.max_rate = '1GiB';
For more information on CockroachDB cluster setting, see Cluster Settings.