Skip to content

Commit 12345ee

Browse files
authored
Merge pull request #96139 from itechedit/virtual-network-test-latency
edit pass: virtual-network-test-latency
2 parents 2ec2479 + 5474256 commit 12345ee

File tree

1 file changed

+87
-75
lines changed

1 file changed

+87
-75
lines changed
Lines changed: 87 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Test Azure Virtual Machines network latency in an Azure Virtual Network | Microsoft Docs
2+
title: Test Azure virtual machine network latency in an Azure virtual network | Microsoft Docs
33
description: Learn how to test network latency between Azure virtual machines on a virtual network
44
services: virtual-network
55
documentationcenter: na
@@ -20,113 +20,116 @@ ms.author: steveesp
2020

2121

2222

23-
# Testing network latency
23+
# Test VM network latency
2424

25-
Measuring network latency with a tool that is designed for the task will give the most accurate results. Publicly available tools like SockPerf (for Linux) and Latte (for Windows) are examples of tools that can isolate and measure network latency while excluding other types of latency, such as application latency. These tools focus on the kind of network traffic that affects application performance, namely TCP and UDP. Other common connectivity tools, like ping, may sometimes be used for measuring latency but those results may not be representative of network traffic used in real workloads. That's because most of these tools employ the ICMP protocol, which can be treated differently from application traffic, and the results may not be applicable to workloads that use TCP and UDP. For accurate network latency testing of protocols used by most applications, SockPerf (for Linux) and Latte (for Windows) produce the most relevant results. This document covers both of these tools.
25+
To achieve the most accurate results, measure your Azure virtual machine (VM) network latency with a tool that's designed for the task. Publicly available tools such as SockPerf (for Linux) and latte.exe (for Windows) can isolate and measure network latency while excluding other types of latency, such as application latency. These tools focus on the kind of network traffic that affects application performance (namely, Transmission Control Protocol [TCP] and User Datagram Protocol [UDP] traffic).
26+
27+
Other common connectivity tools, such as Ping, might measure latency, but their results might not represent the network traffic that's used in real workloads. That's because most of these tools employ the Internet Control Message Protocol (ICMP), which can be treated differently from application traffic and whose results might not apply to workloads that use TCP and UDP.
28+
29+
For accurate network latency testing of the protocols used by most applications, SockPerf (for Linux) and latte.exe (for Windows) produce the most relevant results. This article covers both of these tools.
2630

2731
## Overview
2832

29-
Using two VMs, one as sender and one as receiver, a two-way communications channel is created to send and receive packets in both directions to measure the round-trip time (RTT).
33+
By using two VMs, one as sender and one as receiver, you create a two-way communications channel. With this approach, you can send and receive packets in both directions and measure the round-trip time (RTT).
3034

31-
These steps can be used to measure network latency between two Virtual Machines (VMs) or even between two physical computers. Latency measurements can be useful for the following scenarios:
35+
You can use this approach to measure network latency between two VMs or even between two physical computers. Latency measurements can be useful for the following scenarios:
3236

33-
- Establish a benchmark for network latency between the deployed VMs
37+
- Establish a benchmark for network latency between the deployed VMs.
3438
- Compare the effects of changes in network latency after related changes are made to:
35-
- OS or network stack software, including configuration changes
36-
- VM deployment method, such as deploying to a Zone or PPG
37-
- VM properties, like Accelerated Networking or size changes
38-
- Virtual network, such as routing or filtering changes
39+
- Operating system (OS) or network stack software, including configuration changes.
40+
- A VM deployment method, such as deploying to an availability zone or proximity placement group (PPG).
41+
- VM properties, such as Accelerated Networking or size changes.
42+
- A virtual network, such as routing or filtering changes.
3943

4044
### Tools for testing
41-
To measure latency we have two different options, one for Windows-based systems, and one for Linux-based systems
42-
43-
For Windows: latte.exe (Windows)
44-
[https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b)
45+
To measure latency, you have two different tool options:
4546

46-
For Linux: SockPerf (Linux)
47-
[https://github.com/mellanox/sockperf](https://github.com/mellanox/sockperf)
47+
* For Windows-based systems: [latte.exe (Windows)](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b)
48+
* For Linux-based systems: [SockPerf (Linux)](https://github.com/mellanox/sockperf)
4849

49-
Using these tools ensures that only TCP or UDP payload delivery times are measured and not ICMP (Ping) or other packet types that aren't used by applications and don't affect their performance.
50+
By using these tools, you help ensure that only TCP or UDP payload delivery times are measured and not ICMP (Ping) or other packet types that aren't used by applications and don't affect their performance.
5051

51-
### Tips for an optimal VM configuration:
52+
### Tips for creating an optimal VM configuration
5253

53-
- Use the latest version of Windows or Linux
54-
- Enable Accelerated Networking for best results
55-
- Deploy VMs with [Azure Proximity Placement Group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location)
56-
- Larger VMs generally perform better than smaller VMs
54+
When you create your VM configuration, keep in mind the following recommendations:
55+
- Use the latest version of Windows or Linux.
56+
- Enable Accelerated Networking for best results.
57+
- Deploy VMs with an [Azure proximity placement group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location).
58+
- Larger VMs generally perform better than smaller VMs.
5759

5860
### Tips for analysis
5961

60-
- Establish a baseline early, as soon as deployment, configuration, and optimizations are complete
61-
- Always compare new results to a baseline or otherwise from one test to another with controlled changes
62-
- Repeat tests whenever changes are observed or planned
63-
64-
65-
## Testing VMs running Windows
62+
As you're analyzing test results, keep in mind the following recommendations:
6663

67-
## Get Latte.exe onto the VMs
64+
- Establish a baseline early, as soon as deployment, configuration, and optimizations are complete.
65+
- Always compare new results to a baseline or, otherwise, from one test to another with controlled changes.
66+
- Repeat tests whenever changes are observed or planned.
6867

69-
Download the latest version: [https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b)
7068

71-
Consider putting Latte.exe in separate folder, like c:\tools
69+
## Test VMs that are running Windows
7270

73-
## Allow Latte.exe through the Windows firewall
71+
### Get latte.exe onto the VMs
7472

75-
On the RECEIVER, create an Allow rule on the Windows Firewall to allow the Latte.exe traffic to arrive. It's easiest to allow the entire Latte.exe program by name rather than to allow specific TCP ports inbound.
73+
Download the [latest version of latte.exe](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b).
7674

77-
Allow Latte.exe through the Windows Firewall like this:
75+
Consider putting latte.exe in separate folder, such as *c:\tools*.
7876

79-
netsh advfirewall firewall add rule program=\<PATH\>\\latte.exe name=&quot;Latte&quot; protocol=any dir=in action=allow enable=yes profile=ANY
77+
### Allow latte.exe through Windows Defender Firewall
8078

79+
On the *receiver*, create an Allow rule on Windows Defender Firewall to allow the latte.exe traffic to arrive. It's easiest to allow the entire latte.exe program by name rather than to allow specific TCP ports inbound.
8180

82-
For example, if you copied latte.exe to the &quot;c:\\tools&quot; folder, this would be the command:
81+
Allow latte.exe through Windows Defender Firewall by running the following command:
8382

8483
```cmd
85-
netsh advfirewall firewall add rule program=c:\tools\latte.exe name="Latte" protocol=any dir=in action=allow enable=yes profile=ANY
84+
netsh advfirewall firewall add rule program=<path>\latte.exe name="Latte" protocol=any dir=in action=allow enable=yes profile=ANY
8685
```
8786

88-
## Running latency tests
87+
For example, if you copied latte.exe to the *c:\tools* folder, this would be the command:
8988

90-
Start latte.exe on the RECEIVER (run from CMD, not from PowerShell):
89+
`netsh advfirewall firewall add rule program=c:\tools\latte.exe name="Latte" protocol=any dir=in action=allow enable=yes profile=ANY`
9190

92-
latte -a &lt;Receiver IP address&gt;:&lt;port&gt; -i &lt;iterations&gt;
91+
### Run latency tests
9392

94-
Around 65k iterations is long enough to return representative results.
93+
* On the *receiver*, start latte.exe (run it from the CMD window, not from PowerShell):
9594

96-
Any available port number is fine.
95+
```cmd
96+
latte -a <Receiver IP address>:<port> -i <iterations>
97+
```
9798
98-
If the VM has an IP address of 10.0.0.4, it would look like this:
99+
Around 65,000 iterations is long enough to return representative results.
99100
100-
```cmd
101-
latte -a 10.0.0.4:5005 -i 65100
102-
```
103-
104-
Start latte.exe on the SENDER (run from CMD, not from PowerShell):
101+
Any available port number is fine.
105102
106-
latte -c -a \<Receiver IP address\>:\<port\> -i \<iterations\>
103+
If the VM has an IP address of 10.0.0.4, the command would look like this:
107104
105+
`latte -a 10.0.0.4:5005 -i 65100`
108106
109-
The resulting command is the same as on the receiver except with the addition of &quot;-c&quot; to indicate that this is the &quot;client&quot; or sender:
107+
* On the *sender*, start latte.exe (run it from the CMD window, not from PowerShell):
110108
111-
```cmd
112-
latte -c -a 10.0.0.4:5005 -i 65100
113-
```
109+
```cmd
110+
latte -c -a <Receiver IP address>:<port> -i <iterations>
111+
```
114112
115-
Wait for the results. Depending on how far apart the VMs are, it could take a few minutes to complete. Consider starting with fewer iterations to test for success before running longer tests.
113+
The resulting command is the same as on the receiver, except with the addition of&nbsp;*-c* to indicate that this is the *client*, or *sender*:
116114
115+
`latte -c -a 10.0.0.4:5005 -i 65100`
117116
117+
Wait for the results. Depending on how far apart the VMs are, the test could take a few minutes to finish. Consider starting with fewer iterations to test for success before running longer tests.
118118
119-
## Testing VMs running Linux
119+
## Test VMs that are running Linux
120120
121-
Use SockPerf. It is available from [https://github.com/mellanox/sockperf](https://github.com/mellanox/sockperf)
121+
To test VMs that are running Linux, use [SockPerf](https://github.com/mellanox/sockperf).
122122
123123
### Install SockPerf on the VMs
124124
125-
​On the Linux VMs (both SENDER and RECEIVER), run these commands to prepare SockPerf on your VMs. Commands are provided for the major distros.
125+
On the Linux VMs, both *sender* and *receiver*, run the following commands to prepare SockPerf on the VMs. Commands are provided for the major distros.
126+
127+
#### For Red Hat Enterprise Linux (RHEL)/CentOS
128+
129+
Run the following commands:
126130
127-
#### For RHEL / CentOS, follow these steps:
128131
```bash
129-
#CentOS / RHEL - Install GIT and other helpful tools
132+
#RHEL/CentOS - Install Git and other helpful tools
130133
sudo yum install gcc -y -q
131134
sudo yum install git -y -q
132135
sudo yum install gcc-c++ -y
@@ -135,21 +138,27 @@ Use SockPerf. It is available from [https://github.com/mellanox/sockperf](https:
135138
sudo yum install -y autoconf
136139
```
137140

138-
#### For Ubuntu, follow these steps:
141+
#### For Ubuntu
142+
143+
Run the following commands:
144+
139145
```bash
140-
#Ubuntu - Install GIT and other helpful tools
146+
#Ubuntu - Install Git and other helpful tools
141147
sudo apt-get install build-essential -y
142148
sudo apt-get install git -y -q
143149
sudo apt-get install -y autotools-dev
144150
sudo apt-get install -y automake
145151
sudo apt-get install -y autoconf
146152
```
147153

148-
#### For all distros, copy, compile and install SockPerf according to the following steps:
154+
#### For all distros
155+
156+
Copy, compile, and install SockPerf according to the following steps:
157+
149158
```bash
150159
#Bash - all distros
151160

152-
#From bash command line (assumes git is installed)
161+
#From bash command line (assumes Git is installed)
153162
git clone https://github.com/mellanox/sockperf
154163
cd sockperf/
155164
./autogen.sh
@@ -162,32 +171,35 @@ make
162171
sudo make install
163172
```
164173

165-
### Run SockPerf on the VMs​
174+
### Run SockPerf on the VMs
175+
176+
After the SockPerf installation is complete, the VMs are ready to run the latency tests.
166177

167-
With the SockPerf installation complete, the VMs are ready to run the latency tests.
178+
First, start SockPerf on the *receiver*.
168179

169-
First, start SockPerf on the RECEIVER.
180+
Any available port number is fine. In this example, we use port 12345:
170181

171-
Any available port number is fine. In this example we use port 12345:
172182
```bash
173183
#Server/Receiver - assumes server's IP is 10.0.0.4:
174184
sudo sockperf sr --tcp -i 10.0.0.4 -p 12345
175185
```
176-
Now that the server is listening, the client can begin sending packets to the server on the port on which it is listening, 12345 in this case.
177186

178-
About 100 seconds is long enough to return representative results as shown in the following example:
187+
Now that the server is listening, the client can begin sending packets to the server on the port on which it is listening (in this case, 12345).
188+
189+
About 100 seconds is long enough to return representative results, as shown in the following example:
190+
179191
```bash
180192
#Client/Sender - assumes server's IP is 10.0.0.4:
181193
sockperf ping-pong -i 10.0.0.4 --tcp -m 350 -t 101 -p 12345 --full-rtt
182194
```
183195

184-
Wait for the results. Depending on how far apart the VMs are, the number of iterations will vary. Consider starting with shorter tests of about 5 seconds to test for success before running longer tests.
196+
Wait for the results. Depending on how far apart the VMs are, the number of iterations will vary. To test for success before you run longer tests, consider starting with shorter tests of about 5 seconds.
185197

186-
This SockPerf example uses a 350 byte message size because it is a typical average size packet. The message size can be adjusted higher or lower to achieve results that more accurately represent the workload that will be running on the VMs.
198+
This SockPerf example uses a 350-byte message size, which is typical for an average packet. You can adjust the size higher or lower to achieve results that more accurately represent the workload that's running on your VMs.
187199

188200

189201
## Next steps
190-
* Improve latency with [Azure Proximity Placement Group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location)
191-
* Learn about how to [Optimize networking for VMs](../virtual-network/virtual-network-optimize-network-bandwidth.md) for your scenario.
192-
* Read about how [bandwidth is allocated to virtual machines](../virtual-network/virtual-machine-network-throughput.md)
193-
* Learn more with [Azure Virtual Network frequently asked questions (FAQ)](../virtual-network/virtual-networks-faq.md)
202+
* Improve latency with an [Azure proximity placement group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location).
203+
* Learn how to [Optimize networking for VMs](../virtual-network/virtual-network-optimize-network-bandwidth.md) for your scenario.
204+
* Read about [how bandwidth is allocated to virtual machines](../virtual-network/virtual-machine-network-throughput.md).
205+
* For more information, see [Azure Virtual Network FAQ](../virtual-network/virtual-networks-faq.md).

0 commit comments

Comments
 (0)