Test VM network throughput by using NTTTCP

Caution

This article references CentOS, a Linux distribution that is End Of Life (EOL) status. Please consider your use and plan accordingly. For more information, see the CentOS End Of Life guidance.

This article describes how to use the free NTTTCP tool from Microsoft to test network bandwidth and throughput performance on Azure Windows or Linux virtual machines (VMs). A tool like NTTTCP targets the network for testing and minimizes the use of other resources that could affect performance.

Prerequisites

  • An Azure account with an active subscription. Create an account for free.
  • Two Windows or Linux virtual machines in Azure. Create a Windows VM or create a Linux VM.
    • To test throughput, you need two VMs of the same size to function as sender and receiver. The two VMs should be in the same proximity placement group or availability set, so you can use their internal IP addresses and exclude load balancers from the test.
    • Note the number of VM cores and the receiver VM IP address to use in the commands. Both the sender and receiver commands use the receiver's IP address.

Note

Testing by using a virtual IP is possible, but is beyond the scope of this article.

Examples used in this article

Setting Value
Receiver VM IP address 10.0.0.5
Number of VM cores 2

Test throughput with Windows VMs or Linux VMs

You can test throughput from Windows VMs by using NTTTCP or from Linux VMs by using NTTTCP-for-Linux.

Prepare VMs and install NTTTCP-for-Windows

  1. On both the sender and receiver VMs, download the latest version of NTTTCP into a separate folder like c:\tools.

  2. Open the Windows command line and navigate to the folder where you downloaded ntttcp.exe.

  3. On the receiver VM, create a Windows Firewall allow rule to allow the NTTTCP traffic to arrive. It's easier to allow nttcp.exe by name than to allow specific inbound TCP ports. Run the following command, replacing c:\tools with your download path for ntttcp.exe if different.

    netsh advfirewall firewall add rule program=c:\tools\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY
    
  4. To confirm your configuration, use the following commands to test a single Transfer Control Protocol (TCP) stream for 10 seconds on the receiver and sender virtual machines:

    Receiver VM

    ntttcp -r -m [<number of VM cores> x 2],*,<receiver IP address> -t 10 -P 1

    ntttcp -r -m 4,*,10.0.0.5 -t 10 -P 1
    

    Sender VM

    ntttcp -s -m [<number of VM cores> x 2],*,<receiver IP address> -t 10 -P 1

    ntttcp -s -m 4,*,10.0.0.5 -t 10 -P 1
    

    Note

    Use the preceding commands only to test configuration.

    Tip

    When you run the test for the first time to verify setup, use a short test duration to get quick feedback. Once you verify the tool is working, extend the test duration to 300 seconds for the most accurate results.

Run throughput tests

Run the test for 300 seconds, or five minutes, on both the sender and receiver VMs. The sender and receiver must specify the same test duration for the -t parameter.

  1. On the receiver VM, run the following command, replacing the <number of VM cores>, and <receiver IP address> placeholders with your own values.

    ntttcp -r -m [<number of VM cores> x 2],*,<receiver IP address> -t 300

    ntttcp -r -m 4,*,10.0.0.5 -t 300
    
  2. On the sender VM, run the following command. The sender and receiver commands differ only in the -s or -r parameter that designates the sender or receiver VM.

    ntttcp -s -m [<number of VM cores> x 2],*,<receiver IP address> -t 300

    ntttcp -s -m 4,*,10.0.0.5 -t 300
    
  3. Wait for the results.

When the test is complete, the output should be similar as the following example:

C:\tools>ntttcp -s -m 4,*,10.0.0.5 -t 300
Copyright Version 5.39
Network activity progressing...


Thread  Time(s) Throughput(KB/s) Avg B / Compl
======  ======= ================ =============
     0  300.006        29617.328     65536.000
     1  300.006        29267.468     65536.000
     2  300.006        28978.834     65536.000
     3  300.006        29016.806     65536.000


#####  Totals:  #####


   Bytes(MEG)    realtime(s) Avg Frame Size Throughput(MB/s)
================ =========== ============== ================
    34243.000000     300.005       1417.829          114.141


Throughput(Buffers/s) Cycles/Byte       Buffers
===================== =========== =============
             1826.262       7.036    547888.000


DPCs(count/s) Pkts(num/DPC)   Intr(count/s) Pkts(num/intr)
============= ============= =============== ==============
     4218.744         1.708        6055.769          1.190


Packets Sent Packets Received Retransmits Errors Avg. CPU %
============ ================ =========== ====== ==========
    25324915          2161992       60412      0     15.075

Test throughput between a Windows VM and a Linux VM

To run NTTTCP throughput tests between a Windows VM and a Linux VM, enable no-sync mode by using the -ns flag on Windows or the -N flag on Linux.

To test with the Windows VM as the receiver, run the following command:

ntttcp -r -m [<number of VM cores> x 2],*,<Linux VM IP address> -t 300

To test with the Windows VM as the sender, run the following command:

ntttcp -s -m [<number of VM cores> x 2],*,<Linux VM IP address> -ns -t 300

Next steps