Bandwidth Limiting

From xx network wiki
Jump to navigation Jump to search
This is a team contributed page

The cMix protocol uses bandwidth in unique ways. It has short bursts (10~100 milliseconds) of medium-high usage and extended periods (250 milliseconds to 5 seconds) of minimal usage. Overall, testing shows it will saturate 20% to 30% of a 100 Mbps connection at the most taxing configuration.

That 20% to 30% figure is dependent on network conditions and other Nodes it is operating with, but in rare circumstances, it may be 20% to 30% of the available bandwidth. If a Node operator has greater than 100 Mbps available and does not want to allow the network to consume beyond the stated requirements, then they can limit bandwidth utilization on the Node.

To do this, Linux traffic control (tc) and Hierarchy Token Bucket (HTB), similar to QoS settings on a router, can be used to limit the bandwidth of cMix and/or Gateway to the desired amount. Configuration requires three pieces of information: (1) the port number(s) of cMix and/or Gateway, (2) the network interface name, and (3) the desired bandwidth cap. The following instructions will describe how to get these values and how to configure traffic control.

Creating a bandwidth limit lower than specified can result in underperforming and eventual removal from the network.
  1. First, get the port number. By default, the port for cMix is 11420 and for Gateway, it is 22840. If the port numbers were changed during setup, they can be found in the following locations.

    1. cMix: The default location is /opt/xxnetwork/config/cmix.yaml. The port is under cmix > port.

    2. Gateway: The default location is /opt/xxnetwork/config/gateway.yaml. The port is under port.

  2. Next, determine the network interface that the machine is operating on. For most machines, the following command should print the currently used network interface.

    Alternatively, manually find the correct network interface by printing out all available interfaces.

    This should result in a similar output to the below. Find the name of the network interface that is currently being used. It will have the correct local IP address.

  3. Add the queuing discipline that will limit the bandwidth for the network interface found.

  4. Set the max bandwidth for the machine. The bandwidth must be set to at least 100 Mbit.

  5. Set the port number that the bandwidth will be limited on. Make sure to use the correct port found in the previous step.

    For cMix:

    For Gateway:

  6. To check that the rules were set correctly, list all the classes.

    This should print a similar output to below.

To stop limiting the bandwidth, the rule can be deleted using the following command.