|
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 Azure 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 network bandwidth or throughput with 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 throughput performance on Azure Windows or Linux virtual machines (VMs). To test network throughput and bandwidth, it's best to use a tool like NTTTCP that 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 either the same [proximity placement proup](/azure/virtual-machines/co-location) or the same [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 VM IP addresses to use in the following procedures. 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 for Windows 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 on Windows or Linux machines. |
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 | +Run the NTTTCP 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. Test duration defaults to 60 seconds if no time parameter is specified. |
39 | 31 |
|
40 |
| -To test a single TCP stream for 10 seconds: |
| 32 | +# [Windows](#tab/windows) |
41 | 33 |
|
42 |
| -Receiver parameters: ntttcp -r -t 10 -P 1 |
| 34 | +### Set up NTTTPS and test configuration |
43 | 35 |
|
44 |
| -Sender parameters: ntttcp -s10.27.33.7 -t 10 -n 1 -P 1 |
| 36 | +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*. |
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 | +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. In the following command, replace the `<path>` placeholder with the path you downloaded *ntttcp.exe* to, such as *c:\\tools\\*. |
48 | 39 |
|
49 |
| -## Testing VMs running WINDOWS: |
| 40 | + ```cmd |
| 41 | + netsh advfirewall firewall add rule program=<path>ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 42 | + ``` |
50 | 43 |
|
51 |
| -#### Get NTTTCP onto the VMs. |
| 44 | + For example, if you copied *ntttcp.exe* to *c:\\tools*, run the following command: |
52 | 45 |
|
53 |
| -Download the latest version: |
54 |
| -https://github.com/microsoft/ntttcp/releases/latest |
| 46 | + `netsh advfirewall firewall add rule program=c:\tools\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY` |
55 | 47 |
|
56 |
| -Consider putting NTTTCP in separate folder, like c:\\tools |
| 48 | +1. To confirm your configuration, test a single Transfer Control Protocol (TCP) stream for 10 seconds by running the following commands: |
57 | 49 |
|
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. |
| 50 | + - On the receiver VM, run `ntttcp -r -t 10 -P 1`. |
| 51 | + - On the sender VM, run `ntttcp -s<receiver IP address> -t 10 -n 1 -P 1`. |
62 | 52 |
|
63 |
| -Allow ntttcp through the Windows Firewall like this: |
| 53 | + >[!TIP] |
| 54 | + >When you run the test for the first time to verify setup, you use a short test period. Once you verify the tool is working, extend the test period to 300 seconds for the most accurate results. |
64 | 55 |
|
65 |
| -netsh advfirewall firewall add rule program=\<PATH\>\\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 56 | + >[!NOTE] |
| 57 | + >Use the preceding commands only to test configuration. |
66 | 58 |
|
67 |
| -For example, if you copied ntttcp.exe to the "c:\\tools" folder, this would be the command: |
| 59 | +### Run NTTTCP tests |
68 | 60 |
|
69 |
| -netsh advfirewall firewall add rule program=c:\\tools\\ntttcp.exe name="ntttcp" protocol=any dir=in action=allow enable=yes profile=ANY |
| 61 | +1. On the receiver VM, start *ntttcp.exe* from the Windows command line, not from PowerShell. Run the following command, replacing the `<number of VM cores>`, and `<receiver IP address>` placeholders with your own values. |
70 | 62 |
|
71 |
| -#### Running NTTTCP tests |
| 63 | + ```cmd |
| 64 | + ntttcp -r -m [<number of VM cores> * 2],*,<receiver IP address> -t 300 |
| 65 | + ``` |
72 | 66 |
|
73 |
| -Start NTTTCP on the RECEIVER (**run from CMD**, not from PowerShell): |
| 67 | + The command for a VM with four cores and an IP address of `10.0.0.4` looks like the following example: |
74 | 68 |
|
75 |
| -ntttcp -r -m [2\*\#num\_cores],\*,a.b.c.r -t 300 |
| 69 | + `ntttcp -r -m 8,*,10.0.0.4 -t 300` |
76 | 70 |
|
77 |
| -If the VM has four cores and an IP address of 10.0.0.4, it would look like this: |
| 71 | +1. On the sender VM, run the following command from a Windows command line. The sender and receiver commands differ only in the `-s` or `-r` parameter that designates the sender or receiver VM. |
78 | 72 |
|
79 |
| -ntttcp -r -m 8,\*,10.0.0.4 -t 300 |
| 73 | + ```cmd |
| 74 | + ntttcp -s -m [<number of VM cores> * 2],*,<receiver IP address> -t 300 |
| 75 | + ``` |
80 | 76 |
|
| 77 | + The following example shows the command if the receiver IP address is `10.0.0.4`: |
| 78 | + |
| 79 | + ```cmd |
| 80 | + ntttcp -s -m 8,*,10.0.0.4 -t 300 |
| 81 | + ``` |
81 | 82 |
|
82 |
| -Start NTTTCP on the SENDER (**run from CMD**, not from PowerShell): |
| 83 | +1. Wait for the results. |
83 | 84 |
|
84 |
| -ntttcp -s -m 8,\*,10.0.0.4 -t 300 |
| 85 | +# [Linux](#tab/linux) |
85 | 86 |
|
86 |
| -Wait for the results. |
| 87 | +### Prepare VMs and install NTTTPS-for-Linux |
87 | 88 |
|
| 89 | +To measure throughput from Linux machines, use [NTTTCP-for-Linux](https://github.com/Microsoft/ntttcp-for-linux). |
88 | 90 |
|
89 |
| -## Testing VMs running LINUX: |
| 91 | +1. On both the sender and receiver VMs, run the following commands to prepare NTTTCP-for-Linux on your VMs, depending on your distro: |
90 | 92 |
|
91 |
| -Use nttcp-for-linux. It is available from <https://github.com/Microsoft/ntttcp-for-linux> |
| 93 | + - For **CentOS**, install `gcc` and `git`: |
92 | 94 |
|
93 |
| -On the Linux VMs (both SENDER and RECEIVER), run these commands to prepare ntttcp-for-linux on your VMs: |
| 95 | + ``` bash |
| 96 | + yum install gcc -y |
| 97 | + yum install git -y |
| 98 | + ``` |
94 | 99 |
|
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 |
| -``` |
| 100 | + - For **Ubuntu**, install `build-essential` and `git`: |
115 | 101 |
|
116 |
| -As in the Windows example, we assume the Linux RECEIVER's IP is 10.0.0.4 |
| 102 | + ``` bash |
| 103 | + apt-get -y install build-essential |
| 104 | + apt-get -y install git |
| 105 | + ``` |
117 | 106 |
|
118 |
| -Start NTTTCP-for-Linux on the RECEIVER: |
| 107 | + - For **SUSE**, install `git-core`, `gcc`, and `make`: |
119 | 108 |
|
120 |
| -``` bash |
121 |
| -ntttcp -r -t 300 |
122 |
| -``` |
| 109 | + ``` bash |
| 110 | + zypper in -y git-core gcc make |
| 111 | + ``` |
123 | 112 |
|
124 |
| -And on the SENDER, run: |
| 113 | +1. Make and install NTTTCP-for-Linux: |
125 | 114 |
|
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 |
| 115 | + ``` bash |
| 116 | + git clone https://github.com/Microsoft/ntttcp-for-linux |
| 117 | + cd ntttcp-for-linux/src |
| 118 | + make && make install |
| 119 | + ``` |
131 | 120 |
|
132 |
| -## Testing between VMs running Windows and LINUX: |
| 121 | +### Run NTTTCP tests |
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 | +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. |
135 | 124 |
|
136 |
| -#### From Linux to Windows: |
| 125 | +1. On the receiver VM, start NTTTCP-for-Linux and run the test for 300 seconds. |
137 | 126 |
|
138 |
| -Receiver \<Windows>: |
| 127 | + ``` bash |
| 128 | + ntttcp -r -t 300 |
| 129 | + ``` |
139 | 130 |
|
140 |
| -``` bash |
141 |
| -ntttcp -r -m <2 x nr cores>,*,<Windows server IP> |
142 |
| -``` |
| 131 | +1. On the sender VM, run NTTTCP-for-Linux for 300 seconds. The command for a receiver VM with an IP address of `10.0.0.4` looks like the following example: |
143 | 132 |
|
144 |
| -Sender \<Linux> : |
| 133 | + ``` bash |
| 134 | + ntttcp -s10.0.0.4 -t 300 |
| 135 | + ``` |
145 | 136 |
|
146 |
| -``` bash |
147 |
| -ntttcp -s -m <2 x nr cores>,*,<Windows server IP> -N -t 300 |
148 |
| -``` |
| 137 | +## Test throughput between Windows and Linux VMs |
149 | 138 |
|
150 |
| -#### From Windows to Linux: |
| 139 | +To run NTTTCP throughput tests between a Windows and a Linux VM, enable no-sync mode by using the `-ns` flag on Windows or the `-N` flag on Linux. |
151 | 140 |
|
152 |
| -Receiver \<Linux>: |
| 141 | +1. Install and configure NTTTCP on the Windows VM and NTTTCP-for-Linux on the Linux VM as instructed in the previous section. |
153 | 142 |
|
154 |
| -``` bash |
155 |
| -ntttcp -r -m <2 x nr cores>,*,<Linux server IP> |
156 |
| -``` |
| 143 | +1. Test throughput on both the Windows and the Linux machines, as follows: |
| 144 | +
|
| 145 | + From the Windows VM: |
157 | 146 |
|
158 |
| -Sender \<Windows>: |
| 147 | + - Test with the Windows VM as the receiver: |
159 | 148 |
|
160 |
| -``` bash |
161 |
| -ntttcp -s -m <2 x nr cores>,*,<Linux server IP> -ns -t 300 |
| 149 | + ```cmd |
| 150 | + ntttcp -r -m [<number of VM cores> * 2],*,<Linux VM IP> |
| 151 | + ``` |
| 152 | + - Test with the Windows VM as the sender: |
| 153 | +
|
| 154 | + ```cmd |
| 155 | + ntttcp -s -m [<number of VM cores> * 2],*,<Linux VM IP> -ns -t 300 |
| 156 | + ``` |
| 157 | +
|
| 158 | + From the Linux VM: |
| 159 | + |
| 160 | + - Test with the Linux VM as the receiver: |
| 161 | +
|
| 162 | + ```bash |
| 163 | + ntttcp -r -m [<number of VM cores> * 2],*,<Windows VM IP> |
| 164 | + ``` |
| 165 | +
|
| 166 | + - Test with the Linux VM as the sender: |
| 167 | +
|
| 168 | + ```bash |
| 169 | + ntttcp -s -m [<number of VM cores> * 2],*,<Windows VM IP> -N -t 300 |
162 | 170 | ```
|
163 |
| -## Testing Cloud Service Instances: |
164 |
| -You need to add following section into your ServiceDefinition.csdef |
| 171 | +
|
| 172 | +## Test Cloud Service instances |
| 173 | +
|
| 174 | +Add the following section to *ServiceDefinition.csdef*: |
| 175 | +
|
165 | 176 | ```xml
|
166 | 177 | <Endpoints>
|
167 | 178 | <InternalEndpoint name="Endpoint3" protocol="any" />
|
168 | 179 | </Endpoints>
|
169 | 180 | ```
|
170 | 181 |
|
171 | 182 | ## 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) |
| 183 | +
|
| 184 | +- [Optimize network throughput for Azure virtual machines](virtual-network-optimize-network-bandwidth.md). |
| 185 | +- [Virtual machine network bandwidth](virtual-machine-network-throughput.md). |
| 186 | +- [Test VM network latency](virtual-network-test-latency.md) |
| 187 | +- [Azure Virtual Network frequently asked questions (FAQ)](virtual-networks-faq.md) |
0 commit comments