Performance

Contenuti

Performance#

MTU#

Increasing the MTU value can, in some cases, improve network efficiency.

Avvertimento

Changing the MTU value could have unintended consequences!

GNU/Linux#

You can change the default Ethernet (IEEE 802.3) MTU value from 1500 to 9000 if all devices you want to use support it (including dumb Ethernet switches).

If you use the networking systemd service provided by Debian there are various possibilities. Once you done the configuration you can check it with ICMP requests like these

Vedi anche

  • How to change MTU size in Linux [1]

  • linux - how to verify if MTU 9000 configured properly on all component - Unix & Linux Stack Exchange [2]

  • sysctl - ArchWiki [3]

ping ${other_host_using_mtu_9000} -s 8972 -Mdo
  1. append the mtu line to the interface configuration file

    /etc/network/interfaces#
    1# [ ... ]
    2
    3auto eth0
    4iface eth0 inet static
    5    # [ ... ]
    6    mtu 9000
    7
    8# [ ... ]
    
  1. reboot

  2. optionally enable MTU probing. See reference 3

    echo "net.ipv4.tcp_mtu_probing = 1" >> /etc/sysctl.conf
    sysctl -p /etc/sysctl.conf
    exit
    

Docker#

Vedi anche

  • Fixing networking for Docker - Civo.com [4]

  • Docker mtu problem - Support - Drone [5]

  • How we spent a full day figuring out a MTU issue with docker | by Sylvain Witmeyer | Medium [6]

  1. add this setting to the daemon configuration file

    /etc/docker/daemon.json#
    1{
    2    "mtu": 9000
    3}
    
  2. restart the service

    systemctl restart docker
    
  3. add a new network with the new MTU value in the Docker compose file

    services:
        myservice_0:
            # [ ... ]
            networks:
                - mynetwork
    
        myservice_1:
            # [ ... ]
            networks:
                - mynetwork
    
        # [ ... ]
    
         myservice_n:
            # [ ... ]
            networks:
                - mynetwork
    
    # [ ... ]
    
    networks:
        mynetwork:
          driver: bridge
          driver_opts:
            com.docker.network.driver.mtu: 9000
    

Note