|
1 | 1 | ---
|
2 |
| -title: Testing Azure VM network throughput |
3 |
| -titlesuffix: Azure Virtual Network |
4 |
| -description: Use NTTTCP to target the network for testing and minimize the use of other resources that could impact performance. |
| 2 | +title: Test VM network throughput by using NTTTCP |
| 3 | +description: Use the NTTTCP tool to test network bandwidth and throughput performance for Windows and Linux VMs on a virtual network. |
5 | 4 | services: virtual-network
|
6 | 5 | author: asudbring
|
7 | 6 | ms.service: virtual-network
|
8 | 7 | ms.topic: how-to
|
9 | 8 | ms.workload: infrastructure-services
|
10 |
| -ms.date: 10/06/2020 |
| 9 | +ms.date: 03/23/2023 |
11 | 10 | ms.author: allensu
|
12 | 11 | ---
|
13 | 12 |
|
14 |
| -# Bandwidth/Throughput testing (NTTTCP) |
| 13 | +# Test VM network throughput by using NTTTCP |
15 | 14 |
|
16 |
| -When testing network throughput performance in Azure, it's best to use a tool that targets the network for testing and minimizes the use of other resources that could impact performance. NTTTCP is recommended. |
| 15 | +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. |
17 | 16 |
|
18 |
| -Copy the tool to two Azure VMs of the same size. One VM functions as SENDER |
19 |
| -and the other as RECEIVER. |
| 17 | +## Prerequisites |
20 | 18 |
|
21 |
| -#### Deploying VMs for testing |
22 |
| -For the purposes of this test, the two VMs should be in either the same [Proximity Placement Group](../virtual-machines/co-location.md) or the same Availability Set so that we can use their internal IPs and exclude the Load Balancers from the test. It is possible to test with the VIP but this kind of testing is outside the scope of this document. |
| 19 | +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](/azure/virtual-machines/co-location) or [availability set](/azure/virtual-machines/availability-set-overview), so you can use their internal IP addresses and exclude load balancers from the test. |
23 | 20 |
|
24 |
| -Make a note of the RECEIVER's IP address. Let's call that IP "a.b.c.r" |
| 21 | +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. |
25 | 22 |
|
26 |
| -Make a note of the number of cores on the VM. Let's call this "\#num\_cores" |
| 23 | +>[!NOTE] |
| 24 | +>Testing by using a virtual IP (VIP) is possible, but is beyond the scope of this article. |
27 | 25 |
|
28 |
| -Run the NTTTCP test for 300 seconds (or 5 minutes) on the sender VM and receiver VM. |
| 26 | +## Test throughput with Windows VMs or Linux VMs |
29 | 27 |
|
30 |
| -Tip: When setting up this test for the first time, you might try a shorter test period to get feedback sooner. Once the tool is working as expected, extend the test period to 300 seconds for the most accurate results. |
| 28 | +You can test throughput from Windows VMs by using [NTTTCP](https://github.com/microsoft/ntttcp) or from Linux VMs by using [NTTTCP-for-Linux](https://github.com/Microsoft/ntttcp-for-linux). |
31 | 29 |
|
32 |
| -> [!NOTE] |
33 |
| -> The sender **and** receiver must specify **the same** test duration |
34 |
| -parameter (-t). |
35 |
| -> |
36 |
| -> The IP address in both Sender and Receiver commands is the Receiver's IP address. |
37 |
| -> |
38 |
| -> The -r and -s flags are no longer required for the receiver and sender parameters. |
| 30 | +# [Windows](#tab/windows) |
39 | 31 |
|
40 |
| -To test a single TCP stream for 10 seconds: |
| 32 | +### Set up NTTTPS and test configuration |
41 | 33 |
|
42 |
| -Receiver parameters: ntttcp -r -t 10 -P 1 |
| 34 | +1. On both the sender and receiver VMs, [download the latest version of NTTTCP](https://github.com/microsoft/ntttcp/releases/latest) into a separate folder like *c:\\tools*. |
43 | 35 |
|
44 |
| -Sender parameters: ntttcp -s10.27.33.7 -t 10 -n 1 -P 1 |
| 36 | +1. 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. |
45 | 37 |
|
46 |
| -> [!NOTE] |
47 |
| -> The preceding sample should only be used to confirm your configuration. Valid examples of testing are covered later in this document. |
| 38 | + ```cmd |
| 39 | + netsh advfirewall firewall add rule program=c:\tools\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 40 | + ``` |
48 | 41 |
|
49 |
| -## Testing VMs running WINDOWS: |
| 42 | +1. To confirm your configuration, test a single Transfer Control Protocol (TCP) stream for 10 seconds by running the following commands: |
50 | 43 |
|
51 |
| -#### Get NTTTCP onto the VMs. |
| 44 | + - On the receiver VM, run `ntttcp -r -t 10 -P 1`. |
| 45 | + - On the sender VM, run `ntttcp -s<receiver IP address> -t 10 -n 1 -P 1`. |
52 | 46 |
|
53 |
| -Download the latest version: |
54 |
| -https://github.com/microsoft/ntttcp/releases/latest |
| 47 | + >[!NOTE] |
| 48 | + >Use the preceding commands only to test configuration. |
55 | 49 |
|
56 |
| -Consider putting NTTTCP in separate folder, like c:\\tools |
| 50 | + >[!TIP] |
| 51 | + >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. |
57 | 52 |
|
58 |
| -#### Allow NTTTCP through the Windows firewall |
59 |
| -On the RECEIVER, create an Allow rule on the Windows Firewall to allow the |
60 |
| -NTTTCP traffic to arrive. It's easiest to allow the entire NTTTCP program by |
61 |
| -name rather than to allow specific TCP ports inbound. |
| 53 | +### Run throughput tests |
62 | 54 |
|
63 |
| -Allow ntttcp through the Windows Firewall like this: |
| 55 | +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. |
64 | 56 |
|
65 |
| -netsh advfirewall firewall add rule program=\<PATH\>\\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 57 | +1. On the receiver VM, run the following command, replacing the `<number of VM cores>`, and `<receiver IP address>` placeholders with your own values. |
66 | 58 |
|
67 |
| -For example, if you copied ntttcp.exe to the "c:\\tools" folder, this would be the command: |
| 59 | + ```cmd |
| 60 | + ntttcp -r -m [<number of VM cores> x 2],*,<receiver IP address> -t 300 |
| 61 | + ``` |
68 | 62 |
|
69 |
| -netsh advfirewall firewall add rule program=c:\\tools\\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 63 | + The following example shows a command for a VM with four cores and an IP address of `10.0.0.4`. |
70 | 64 |
|
71 |
| -#### Running NTTTCP tests |
| 65 | + `ntttcp -r -m 8,*,10.0.0.4 -t 300` |
72 | 66 |
|
73 |
| -Start NTTTCP on the RECEIVER (**run from CMD**, not from PowerShell): |
| 67 | +1. 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. |
74 | 68 |
|
75 |
| -ntttcp -r -m [2\*\#num\_cores],\*,a.b.c.r -t 300 |
| 69 | + ```cmd |
| 70 | + ntttcp -s -m [<number of VM cores> x 2],*,<receiver IP address> -t 300 |
| 71 | + ``` |
76 | 72 |
|
77 |
| -If the VM has four cores and an IP address of 10.0.0.4, it would look like this: |
| 73 | + The following example shows the sender command for a receiver IP address of `10.0.0.4`. |
| 74 | + |
| 75 | + ```cmd |
| 76 | + ntttcp -s -m 8,*,10.0.0.4 -t 300 |
| 77 | + ``` |
78 | 78 |
|
79 |
| -ntttcp -r -m 8,\*,10.0.0.4 -t 300 |
| 79 | +1. Wait for the results. |
80 | 80 |
|
| 81 | +# [Linux](#tab/linux) |
81 | 82 |
|
82 |
| -Start NTTTCP on the SENDER (**run from CMD**, not from PowerShell): |
| 83 | +### Prepare VMs and install NTTTPS-for-Linux |
83 | 84 |
|
84 |
| -ntttcp -s -m 8,\*,10.0.0.4 -t 300 |
| 85 | +To measure throughput from Linux machines, use [NTTTCP-for-Linux](https://github.com/Microsoft/ntttcp-for-linux). |
85 | 86 |
|
86 |
| -Wait for the results. |
| 87 | +1. Prepare both the sender and receiver VMs for NTTTCP-for-Linux by running the following commands, depending on your distro: |
87 | 88 |
|
| 89 | + - For **CentOS**, install `gcc` and `git`. |
88 | 90 |
|
89 |
| -## Testing VMs running LINUX: |
| 91 | + ``` bash |
| 92 | + yum install gcc -y |
| 93 | + yum install git -y |
| 94 | + ``` |
90 | 95 |
|
91 |
| -Use nttcp-for-linux. It is available from <https://github.com/Microsoft/ntttcp-for-linux> |
| 96 | + - For **Ubuntu**, install `build-essential` and `git`. |
92 | 97 |
|
93 |
| -On the Linux VMs (both SENDER and RECEIVER), run these commands to prepare ntttcp-for-linux on your VMs: |
| 98 | + ``` bash |
| 99 | + apt-get -y install build-essential |
| 100 | + apt-get -y install git |
| 101 | + ``` |
94 | 102 |
|
95 |
| -CentOS - Install gcc and git: |
96 |
| -``` bash |
97 |
| - yum install gcc -y |
98 |
| - yum install git -y |
99 |
| -``` |
100 |
| -Ubuntu - Install build-essential and git: |
101 |
| -``` bash |
102 |
| - apt-get -y install build-essential |
103 |
| - apt-get -y install git |
104 |
| -``` |
105 |
| -SUSE - Install git-core, gcc, and make: |
106 |
| -``` bash |
107 |
| - zypper in -y git-core gcc make |
108 |
| -``` |
109 |
| -Make and Install on both: |
110 |
| -``` bash |
111 |
| - git clone https://github.com/Microsoft/ntttcp-for-linux |
112 |
| - cd ntttcp-for-linux/src |
113 |
| - make && make install |
114 |
| -``` |
| 103 | + - For **SUSE**, install `git-core`, `gcc`, and `make`. |
115 | 104 |
|
116 |
| -As in the Windows example, we assume the Linux RECEIVER's IP is 10.0.0.4 |
| 105 | + ``` bash |
| 106 | + zypper in -y git-core gcc make |
| 107 | + ``` |
117 | 108 |
|
118 |
| -Start NTTTCP-for-Linux on the RECEIVER: |
| 109 | +1. Make and install NTTTCP-for-Linux. |
119 | 110 |
|
120 |
| -``` bash |
121 |
| -ntttcp -r -t 300 |
122 |
| -``` |
| 111 | + ``` bash |
| 112 | + git clone https://github.com/Microsoft/ntttcp-for-linux |
| 113 | + cd ntttcp-for-linux/src |
| 114 | + make && make install |
| 115 | + ``` |
123 | 116 |
|
124 |
| -And on the SENDER, run: |
| 117 | +### Run throughput tests |
125 | 118 |
|
126 |
| -``` bash |
127 |
| -ntttcp -s10.0.0.4 -t 300 |
128 |
| -``` |
129 |
| - |
130 |
| -Test length defaults to 60 seconds if no time parameter is given |
| 119 | +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. |
131 | 120 |
|
132 |
| -## Testing between VMs running Windows and LINUX: |
| 121 | +1. On the receiver VM, run the following command: |
133 | 122 |
|
134 |
| -On this scenarios we should enable the no-sync mode so the test can run. This is done by using the **-N flag** for Linux, and **-ns flag** for Windows. |
| 123 | + ``` bash |
| 124 | + ntttcp -r -t 300 |
| 125 | + ``` |
135 | 126 |
|
136 |
| -#### From Linux to Windows: |
| 127 | +1. On the sender VM, run the following command. This example shows a sender command for a receiver IP address of `10.0.0.4`. |
137 | 128 |
|
138 |
| -Receiver \<Windows>: |
| 129 | + ``` bash |
| 130 | + ntttcp -s10.0.0.4 -t 300 |
| 131 | + ``` |
139 | 132 |
|
140 |
| -``` bash |
141 |
| -ntttcp -r -m <2 x nr cores>,*,<Windows server IP> |
142 |
| -``` |
| 133 | +--- |
| 134 | +## Test throughput between a Windows VM and a Linux VM |
| 135 | +
|
| 136 | +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. |
143 | 137 |
|
144 |
| -Sender \<Linux> : |
| 138 | +# [Windows](#tab/windows) |
145 | 139 |
|
146 |
| -``` bash |
147 |
| -ntttcp -s -m <2 x nr cores>,*,<Windows server IP> -N -t 300 |
| 140 | +To test with the Windows VM as the receiver, run the following command: |
| 141 | +
|
| 142 | +```cmd |
| 143 | +ntttcp -r -m [<number of VM cores> x 2],*,<Linux VM IP address> -t 300 |
| 144 | +``` |
| 145 | +To test with the Windows VM as the sender, run the following command: |
| 146 | +
|
| 147 | +```cmd |
| 148 | +ntttcp -s -m [<number of VM cores> x 2],*,<Linux VM IP address> -ns -t 300 |
148 | 149 | ```
|
149 | 150 |
|
150 |
| -#### From Windows to Linux: |
| 151 | +# [Linux](#tab/linux) |
151 | 152 |
|
152 |
| -Receiver \<Linux>: |
| 153 | +To test with the Linux VM as the receiver, run the following command: |
153 | 154 |
|
154 |
| -``` bash |
155 |
| -ntttcp -r -m <2 x nr cores>,*,<Linux server IP> |
| 155 | +```bash |
| 156 | +ntttcp -r -m [<number of VM cores> x 2],*,<Windows VM IP address> -t 300 |
156 | 157 | ```
|
157 | 158 |
|
158 |
| -Sender \<Windows>: |
| 159 | +To test with the Linux VM as the sender, run the following command: |
159 | 160 |
|
160 |
| -``` bash |
161 |
| -ntttcp -s -m <2 x nr cores>,*,<Linux server IP> -ns -t 300 |
| 161 | +```bash |
| 162 | +ntttcp -s -m [<number of VM cores> x 2],*,<Windows VM IP address> -N -t 300 |
162 | 163 | ```
|
163 |
| -## Testing Cloud Service Instances: |
164 |
| -You need to add following section into your ServiceDefinition.csdef |
| 164 | +--- |
| 165 | +
|
| 166 | +## Test Cloud Service instances |
| 167 | +
|
| 168 | +Add the following section to *ServiceDefinition.csdef*: |
| 169 | +
|
165 | 170 | ```xml
|
166 | 171 | <Endpoints>
|
167 | 172 | <InternalEndpoint name="Endpoint3" protocol="any" />
|
168 | 173 | </Endpoints>
|
169 | 174 | ```
|
170 | 175 |
|
171 | 176 | ## Next steps
|
172 |
| -* Depending on results, there may be room to [Optimize network throughput machines](virtual-network-optimize-network-bandwidth.md) for your scenario. |
173 |
| -* Read about how [bandwidth is allocated to virtual machines](virtual-machine-network-throughput.md) |
174 |
| -* Learn more with [Azure Virtual Network frequently asked questions (FAQ)](virtual-networks-faq.md) |
| 177 | +
|
| 178 | +- [Optimize network throughput for Azure virtual machines](virtual-network-optimize-network-bandwidth.md). |
| 179 | +- [Virtual machine network bandwidth](virtual-machine-network-throughput.md). |
| 180 | +- [Test VM network latency](virtual-network-test-latency.md) |
| 181 | +- [Azure Virtual Network frequently asked questions (FAQ)](virtual-networks-faq.md) |
0 commit comments