Optimizing OS Parameters
You can improve the openGauss performance by modifying key parameters of the OS based on actual service requirements during the performance optimization.
Prerequisites
You have checked whether the OS parameters are set to the suggested values using gs_check. If not, modify them as required.
Memory Parameters
In the sysctl.conf file, change the value of vm.extfrag_threshold to 1000 (reference value). If the file does not contain memory parameters, add them manually.
vim /etc/sysctl.conf
Run the following command to make the modification take effect:
sysctl -p
Network Parameters
In the sysctl.conf file, modify network parameters. If the file does not contain such parameters, add them manually. For details, see Table 1.
vim /etc/sysctl.conf
Run the following command to make the modification take effect:
sysctl -p
Table 1 Network parameters
Use the ifconfig command to set the maximum transmission unit (MTU) of 10 GE NICs. The value 8192 is recommended because this setting improves the network bandwidth usage.
Example:
#ifconfig ethx mtu 8192 #ifconfig ethx ethx Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:xxx.xxx.xxx.0 inet6 addr: fxxx::9xxx:bxxx:xxxa:1d18/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:8192 Metric:1 RX packets:179849803 errors:0 dropped:0 overruns:0 frame:0 TX packets:40492292 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:17952090386 (17120.4 Mb) TX bytes:171359670290 (163421.3 Mb)
NOTE:
- ethx indicates the 10 GE service NIC used in the database.
- The first command is used to set the MTU. The second command is used to verify that the MTU has been successfully set. The texts in bold indicate the value of the MTU.
- Set the MTU as user root.
Use ethtool to set the length of the receiving (RX) queue and that of the sending (TX) queue for 10 GE NICs. The value 4096 is recommended because this setting improves the network bandwidth usage.
Example:
# ethtool -G ethx rx 4096 tx 4096 # ethtool -g ethx Ring parameters for ethx: Pre-set maximums: RX: 4096 RX Mini: 0 RX Jumbo: 0 TX: 4096 Current hardware settings: RX: 4096 RX Mini: 0 RX Jumbo: 0 TX: 4096
NOTE:
- ethx indicates the 10 GE service NIC used in the database.
- The first command is used to set the lengths of the receiving and sending queues. The second command is to verify whether the lengths have been successfully set. If information similar to the example is displayed, the setting is successful.
- Set the lengths of the receiving and sending queues as user root.
I/O Parameters
Set the hugepage attribute. Run the following commands to disable the transparent huge page function:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
Run the following command to make the modification take effect:
reboot