Help Center/ Huawei Cloud EulerOS/ User Guide/ Tools/ Pod Bandwidth Management Tool
Updated on 2024-09-14 GMT+08:00

Pod Bandwidth Management Tool

In hybrid service deployments, the pod bandwidth management function schedules resources based on QoS levels to improve network bandwidth utilization. HCE provides oncn-tbwm for you to manage the pod bandwidth. You can run the tbwmcli commands to limit the network rate in packet sending and receiving.

Prerequisites

Before using the bandwidth management tool, ensure that the virtual NIC ifb0 is not in use, and load the ifb driver.

Constraints

  • Only HCE 2.0 of x86 architecture supports the tbwmcli commands.
  • Only the root user is allowed to run the tbwmcli commands.
  • The tbwmcli commands can be used to enable the QoS function for only one NIC at a time.
  • After the NIC is removed and then inserted, the original QoS rules will be lost. In this case, you need to manually reconfigure the QoS function.
  • tbwmcli commands are not supported for cgroup v2.
  • Upgrading the oncn-tbwm software package does not affect the enabling status before the upgrade. Uninstalling the oncn-tbwm software package will disable the QoS function for all devices.
  • Only NIC names containing digits, letters, hyphens (-), and underscores (_) can be identified.
  • Bandwidth limiting may cause protocol stack memory overstock. If this happens, the transport layer protocol will perform backpressure. For UDP and other protocols that do not have backpressure mechanisms, packet loss, ENOBUFS, and inaccurate traffic limiting may occur.
  • Network rate limiting for packet receiving depends on the TCP backpressure capability. In scenarios where TCP is not used, network packets have been received by the target NIC, and network rate limiting is not supported.
  • The tbwmcli, tc, and NIC commands cannot be used together. You can only run the tbwmcli commands for rate limiting. For example, if the tc qdisc rule has been configured for a NIC, enabling the QoS function for the NIC may fail.

How to Use

  1. Install the oncn-tbwm software package.
    1. Confirm that the repository is configured correctly.

      Check whether the parameters in the /etc/yum.repos.d/hce.repo file are configured correctly. The correct configuration is as follows:

      [base]
      name=HCE $releasever base
      baseurl=https://repo.huaweicloud.com/hce/$releasever/os/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=https://repo.huaweicloud.com/hce/$releasever/os/RPM-GPG-KEY-HCE-2
      
      [updates]
      name=HCE $releasever updates
      baseurl=https://repo.huaweicloud.com/hce/$releasever/updates/$basearch/
      ......
    2. Run yum install oncn-tbwm to install the oncn-tbwm software package.
    3. Verify the oncn-tbwm software package.
      • Run tbwmcli -v. If the following information is displayed, the installation is successful:
        version: 1.0
      • Check whether the following oncn-tbwm service components exist.
        /usr/bin/tbwmcli
        /usr/share/tbwmcli
        /usr/share/tbwmcli/README.md
        /usr/share/tbwmcli/bwm_prio_kern.o
        /usr/share/tbwmcli/tbwm_tc.o
  2. Run the tbwmcli command as required.
    Table 1 tbwmcli commands

    Command

    Description

    tbwmcli -e ethx

    tbwmcli -d ethx egress

    Enables or disables the packet sending QoS for a NIC.

    Example: Enabling the packet sending QoS for eth0

    tbwmcli -e eth0
    enable eth0 egress success

    Example: Disabling the packet sending QoS for eth0

    tbwmcli -d eth0 egress
    disable eth0 egress success

    tbwmcli -i ethx online/offline

    tbwmcli -d ethx ingress

    Enables or disables the packet receiving QoS for a NIC.

    Example: Enabling the packet receiving QoS for eth0 and setting eth0 as an online NIC

    tbwmcli -i eth0 online
    enable eth0 ingress success, dev is online

    Example: Enabling the packet receiving QoS for eth0 and setting eth0 as an offline NIC

    tbwmcli -i eth0 offline
    enable eth0 ingress success, dev is offline
    NOTE:

    Packet receiving QoS cannot be set for multiple offline NICs at the same time. Packet receiving QoS can only be set for one offline NIC but multiple online NICs.

    Example: Disabling the packet receiving QoS for eth0

    tbwmcli -d eth0 ingress
    disable eth0 ingress success

    tbwmcli -d ethx

    Forcibly disables QoS for a NIC and disables ifb.

    Example: Forcibly disabling QoS for eth0 and disabling ifb

    tbwmcli -d eth0
    disable eth0 success

    tbwmcli -p istats/estats

    Displays the internal statistics of the packet sender and receiver.

    Example: Displaying the internal statistics of the packet receiver

    tbwmcli -p istats
    offline_target_bandwidth: 94371840online_pkts: 3626190offline_pkts: 265807online_rate: 0offline_rate: 13580offline_prio: 0

    Example: Displaying the internal statistics of the packet sender

    tbwmcli -p estats
    offline_target_bandwidth: 94371840online_pkts: 4805452offline_pkts: 373961online_rate: 0offline_rate: 19307offline_prio: 1

    tbwmcli -s path <prio>

    tbwmcli -p path

    Sets or queries the QoS priority of a cgroup.

    Currently, only two QoS priorities can be set.

    • 0: Sets the cgroup online.
    • -1: Sets the cgroup offline.

    Example: Setting the priority of the test_online cgroup to 0

    tbwmcli -s /sys/fs/cgroup/test_online 0
    set prio success

    Querying the priority of the test_online cgroup

    tbwmcli -p /sys/fs/cgroup/test_online
    prio is 0

    tbwmcli -s bandwidth <low, high>

    tbwmcli -p bandwidth

    Sets or queries the offline bandwidth range.

    Example: Setting the offline bandwidth range to 30 Mbit/s to 100 Mbit/s

    tbwmcli -s bandwidth 30mb,100mb
    set bandwidth success

    Example: Querying the offline bandwidth range

    tbwmcli -p bandwidth
    bandwidth is 31457280(B),104857600(B)

    tbwmcli -s waterline <val>

    tbwmcli -p waterlin

    Sets or queries the online network bandwidth threshold.

    Example: Setting the online network bandwidth threshold to 20 Mbit/s

    tbwmcli -s waterline 20mb
    set waterline success

    Example: Querying the online network bandwidth threshold

    tbwmcli -p waterline
    waterline is 20971520 (B)

    tbwmcli -p devs

    Checks the enabling status of all NICs in the system.

    tbwmcli -p devs
    lo      Egress : disabled
    lo      Ingress : disabled
    eth0    Egress : disabled
    eth0    Ingress : enabled, it's offline
    ifb0    Egress : enabled

    tbwmcli -c

    Forcibly deletes the QoS settings of all NICs.

    modprobe ifb numifbs=1

    Loads ifb.

    rmmod ifb

    Uninstalls ifb.