Test VM network throughput by using NTTTCP

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

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 (VIP) is possible, but is beyond the scope of this article.

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.

Set up NTTTPS and test configuration

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

  2. On the receiver VM, create a Windows Defender 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
    
  3. To confirm your configuration, test a single Transfer Control Protocol (TCP) stream for 10 seconds by running the following commands:

    • On the receiver VM, run ntttcp -r -t 10 -P 1.
    • On the sender VM, run ntttcp -s<receiver IP address> -t 10 -n 1 -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 ntttcp.exe from the Windows command line, not from PowerShell. 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
    

    The following example shows a command for a VM with four cores and an IP address of 10.0.0.4.

    ntttcp -r -m 8,*,10.0.0.4 -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
    

    The following example shows the sender command for a receiver IP address of 10.0.0.4.

    ntttcp -s -m 8,*,10.0.0.4 -t 300 
    
  3. Wait for the results.

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

Test Cloud Service instances

Add the following section to ServiceDefinition.csdef:

<Endpoints>
  <InternalEndpoint name="Endpoint3" protocol="any" />
</Endpoints> 

Next steps