Updated on 2022-06-11 GMT+08:00

Optimizing OS Parameters

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, you can 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

    Parameter

    Reference Value

    Description

    net.ipv4.tcp_timestamps

    0

    Specifies whether to enable quick reclamation of the sockets in TIME-WAIT state during TCP connection establishment. The parameter value 0 indicates that quick reclamation is disabled.

    net.ipv4.tcp_mem

    94500000 915000000 927000000

    94500000: If less than 94,500,000 pages are used by the TCP, the kernel is not affected.

    915000000: If more than 915,000,000 pages are used by the TCP, the kernel enters the memory pressure mode.

    927000000: If more than 927,000,000 pages are used by the TCP, the "Out of socket memory." message is displayed.

    net.ipv4.tcp_max_orphans

    3276800

    Specifies the maximum number of the orphan sockets.

    net.ipv4.tcp_fin_timeout

    20

    Specifies the default timeout period.

    net.ipv4.ip_local_port_range

    32768 65000

    Specifies the port range that can be used by TCP or UDP.

  • Use the ifconfig command to set the maximum transmission unit (MTU) of 10 GE NICs. The value 1500 is recommended because this setting improves the network bandwidth usage.

    When comm_tcp_mode is set to false for CNs or DNs, set the MTU sizes in the clusters to the same value. Otherwise, network communications may fail.

    For example:

    #ifconfig ethx mtu 1500
    #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:1500  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)
    • 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.

    For 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
    • 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. To disable the transparent hugepage, add the following content to the end of the first kernel line in the /boot/grub/menu.lst file:

transparent_hugepage=never

Run the following command to make the modification take effect:

reboot