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

  • 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-Linux

To measure throughput from Linux machines, use NTTTCP-for-Linux.

  1. Prepare both the sender and receiver VMs for NTTTCP-for-Linux by running the following commands, depending on your distro:

    • For Ubuntu, install build-essential and git.

      Bash
      sudo apt-get update
      sudo apt-get -y install build-essential
      sudo apt-get -y install git
      
    • For SUSE, install git-core, gcc, and make.

      Bash
      sudo zypper in -y git-core gcc make
      
  2. Make and install NTTTCP-for-Linux.

    Bash
    git clone https://github.com/Microsoft/ntttcp-for-linux
    cd ntttcp-for-linux/src
    sudo make && sudo make install
    

Run throughput tests

Run the NTTTCP test for 300 seconds, or five minutes, on both the sender VM and the receiver VM. The sender and receiver must specify the same test duration for the -t parameter. Test duration defaults to 60 seconds if you don't specify a time parameter.

  1. On the receiver VM, run the following command:

    Bash
    ntttcp -r -m 4,*,10.0.0.5 -t 300
    
  2. On the sender VM, run the following command. This example shows a sender command for a receiver IP address of 10.0.0.5.

    Bash
    ntttcp -s -m 4,*,10.0.0.5 -t 300
    

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

Output
azureuser@vm-3:~/ntttcp-for-linux/src$ ntttcp -s -m 4,*,10.0.0.5 -t 300
NTTTCP for Linux 1.4.0
---------------------------------------------------------
23:59:01 INFO: 4 threads created
23:59:01 INFO: 4 connections created in 1933 microseconds
23:59:01 INFO: Network activity progressing...
00:04:01 INFO: Test run completed.
00:04:01 INFO: Test cycle finished.
00:04:01 INFO: 4 connections tested
00:04:01 INFO: #####  Totals:  #####
00:04:01 INFO: test duration:300.00 seconds
00:04:01 INFO: total bytes:35750674432
00:04:01 INFO:  throughput:953.35Mbps
00:04:01 INFO:  retrans segs:13889
00:04:01 INFO: cpu cores:2
00:04:01 INFO:  cpu speed:2793.437MHz
00:04:01 INFO:  user:0.16%
00:04:01 INFO:  system:1.60%
00:04:01 INFO:  idle:98.07%
00:04:01 INFO:  iowait:0.05%
00:04:01 INFO:  softirq:0.12%
00:04:01 INFO:  cycles/byte:0.91
00:04:01 INFO: cpu busy (all):3.96%
---------------------------------------------------------

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 Linux VM as the receiver, run the following command:

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

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

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

Next steps